cifs: print nosharesock value while dumping mount options
Subsystems (2)
PATCH 1/2 cifs: print nosharesock value while dumping mount options
We print most other mount options for a mount when dumping the mount entries. But miss out the nosharesock value. This change will print that in addition to the other options.
--- fs/smb/client/cifsfs.c | 2 ++ 1 file changed, 2 insertions(+)
fs/smb/client/cifsfs.c +2 -0
@@ -688,6 +688,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_puts (s,",noautotune" );if (tcon->ses->server->noblocksnd)seq_puts (s,",noblocksend" ); +if (tcon->ses->server->nosharesock) +seq_puts (s,",nosharesock" );if (tcon->snapshot_time)seq_printf (s,",snapshot=%llu" , tcon->snapshot_time);
Signature · 1 line
2.34.1
PATCH 2/2 cifs: allow dumping keys for directories too
Dumping the enc/dec keys is a session wide operation. And it should not matter if the ioctl was run on a regular file or a directory.
Currently, we obtain the tcon pointer from the cifs file handle. But since there's no dir open call in cifs, this is not populated for dirs.
This change allows dumping of session keys using ioctl even for directories. To do this, we'll now get the tcon pointer from the superblock, and not from the file handle.
--- fs/smb/client/ioctl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
fs/smb/client/ioctl.c +13 -4
@@ -433,16 +433,21 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)* Dump encryption keys. This is an old ioctl that only * handles AES-128-{CCM,GCM}. */ -if (pSMBFile ==NULL ) -break ;if (!capable (CAP_SYS_ADMIN )) { rc = -EACCES ;break ; } - tcon =tlink_tcon (pSMBFile->tlink); + cifs_sb =CIFS_SB (inode->i_sb); + tlink =cifs_sb_tlink (cifs_sb); +if (IS_ERR (tlink)) { + rc =PTR_ERR (tlink); +break ; + } + tcon =tlink_tcon (tlink);if (!smb3_encryption_required (tcon)) { rc = -EOPNOTSUPP ; +cifs_put_tlink (tlink);break ; } pkey_inf.cipher_type =
@@ -459,6 +464,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc = -EFAULT ; else rc =0 ; +cifs_put_tlink (tlink);break ;case CIFS_DUMP_FULL_KEY :/*
@@ -470,8 +476,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc = -EACCES ;break ; } - tcon =tlink_tcon (pSMBFile->tlink); + cifs_sb =CIFS_SB (inode->i_sb); + tlink =cifs_sb_tlink (cifs_sb); + tcon =tlink_tcon (tlink); rc =cifs_dump_full_key (tcon, (void __user *)arg); +cifs_put_tlink (tlink);break ;case CIFS_IOC_NOTIFY :if (!S_ISDIR (inode->i_mode)) {
Signature · 1 line
2.34.1
Steve French
Appliedmerged into cifs-2.6.git for-next
Note that nosharesock was being printed before, but only in /proc/fs/cifs/DebugData not in /proc/mounts
Quoted 24 lines · Shyam Prasad N
We print most other mount options for a mount when dumping the mount entries. But miss out the nosharesock value. This change will print that in addition to the other options.
Signed-off-by Shyam Prasad N <[email protected]>--- fs/smb/client/cifsfs.c | 2 ++ 1 file changed, 2 insertions(+)fs/smb/client/cifsfs.c +2
-1@@ -688,6 +688,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_puts (s,",noautotune" );if (tcon->ses->server->noblocksnd)seq_puts (s,",noblocksend" ); +if (tcon->ses->server->nosharesock) +seq_puts (s,",nosharesock" );if (tcon->snapshot_time)seq_printf (s,",snapshot=%llu" , tcon->snapshot_time); --
Quoted 2 lines
2.34.1
--
Thanks,
Steve
Quoted 11 lines · Shyam Prasad N
Quoted 10 lines
We print most other mount options for a mount when dumping the mount entries. But miss out the nosharesock value. This change will print that in addition to the other options.
Signed-off-by Shyam Prasad N <[email protected]>--- fs/smb/client/cifsfs.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 10 lines
fs/smb/client/cifsfs.c cifs_show_options(struct seq_file *s, struct dentry *root) · line 692
Quoted 10 lines
fs/smb/client/cifsfs.c +2
-0@@ -688,6 +688,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)seq_puts (s,",noautotune" );if (tcon->ses->server->noblocksnd)seq_puts (s,",noblocksend" ); +if (tcon->ses->server->nosharesock) +seq_puts (s,",nosharesock" );
Reviewed by Bharath.