Various fixes for multiuser SMB mounts
Subsystems (2)
cover Various fixes for multiuser SMB mounts
Ensure several mount parameters work properly on multiuser mounts for non-root users, and add the user ID / credentials user ID to the session output in DebugData.
Note that the 'posix' fix is speculative, as I don't currently have a server instance that supports SMB2 posix extensions.
Regards,
~Paul
PATCH 1/6 cifs: Display local UID details for SMB sessions in DebugData
This is useful for distinguishing SMB sessions on a multiuser mount.
--- fs/cifs/cifs_debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/cifs/cifs_debug.c +5 -1
@@ -399,6 +399,10 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)if (ses->sign)seq_puts (m," signed" ); +seq_printf (m,"\n\tUser: %d Cred User: %d" , +from_kuid (&init_user_ns, ses->linux_uid), +from_kuid (&init_user_ns, ses->cred_uid)); +if (ses->chan_count >1 ) {seq_printf (m,"\n\n\tExtra Channels: %zu\n" , ses->chan_count-1 );
@@ -406,7 +410,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)cifs_dump_channel (m, j, &ses->chans[j]); } -seq_puts (m,"\n\tShares:" ); +seq_puts (m,"\n\n\tShares:" ); j =0 ;seq_printf (m,"\n\t%d) IPC: " , j);
Signature · 1 line
2.27.0
PATCH 2/6 SMB3: Honor 'seal' flag for multiuser mounts
In reply to Paul AurichEnsure multiuser SMB3 mounts use encryption for all users' tcons if the mount options are configured to require encryption. Without this, only the primary tcon and IPC tcons are guaranteed to be encrypted. Per-user tcons would only be encrypted if the server was configured to require encryption.
--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -5309,6 +5309,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) vol_info->no_linux_ext = !master_tcon->unix_ext; vol_info->sectype = master_tcon->ses->sectype; vol_info->sign = master_tcon->ses->sign; + vol_info->seal = master_tcon->seal; rc =cifs_set_vol_auth (vol_info, master_tcon->ses);if (rc) {
Signature · 1 line
2.27.0
PATCH 3/6 SMB3: Honor persistent/resilient handle flags for multiuser mounts
In reply to Paul AurichWithout this:
- persistent handles will only be enabled for per-user tcons if the server advertises the 'Continuous Availabity' capability
- resilient handles would never be enabled for per-user tcons
--- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/connect.c +2 -0
@@ -5306,6 +5306,8 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) vol_info->nocase = master_tcon->nocase; vol_info->nohandlecache = master_tcon->nohandlecache; vol_info->local_lease = master_tcon->local_lease; + vol_info->resilient = master_tcon->use_resilient; + vol_info->persistent = master_tcon->use_persistent; vol_info->no_linux_ext = !master_tcon->unix_ext; vol_info->sectype = master_tcon->ses->sectype; vol_info->sign = master_tcon->ses->sign;
Signature · 1 line
2.27.0
PATCH 4/6 SMB3: Honor lease disabling for multiuser mounts
In reply to Paul Aurich--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -5306,6 +5306,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) vol_info->nocase = master_tcon->nocase; vol_info->nohandlecache = master_tcon->nohandlecache; vol_info->local_lease = master_tcon->local_lease; + vol_info->no_lease = master_tcon->no_lease; vol_info->resilient = master_tcon->use_resilient; vol_info->persistent = master_tcon->use_persistent; vol_info->no_linux_ext = !master_tcon->unix_ext;
Signature · 1 line
2.27.0
PATCH 5/6 SMB3: Honor 'handletimeout' flag for multiuser mounts
In reply to Paul Aurich--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -5309,6 +5309,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) vol_info->no_lease = master_tcon->no_lease; vol_info->resilient = master_tcon->use_resilient; vol_info->persistent = master_tcon->use_persistent; + vol_info->handle_timeout = master_tcon->handle_timeout; vol_info->no_linux_ext = !master_tcon->unix_ext; vol_info->sectype = master_tcon->ses->sectype; vol_info->sign = master_tcon->ses->sign;
Signature · 1 line
2.27.0
PATCH 6/6 SMB3: Honor 'posix' flag for multiuser mounts
In reply to Paul AurichThe flag from the primary tcon needs to be copied into the volume info so that cifs_get_tcon will try to enable extensions on the per-user tcon. At that point, since posix extensions must have already been enabled on the superblock, don't try to needlessly adjust the mount flags.
--- fs/cifs/connect.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
fs/cifs/connect.c +1 -4
@@ -5311,6 +5311,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) vol_info->persistent = master_tcon->use_persistent; vol_info->handle_timeout = master_tcon->handle_timeout; vol_info->no_linux_ext = !master_tcon->unix_ext; + vol_info->linux_ext = master_tcon->posix_extensions; vol_info->sectype = master_tcon->ses->sectype; vol_info->sign = master_tcon->ses->sign; vol_info->seal = master_tcon->seal;
@@ -5339,10 +5340,6 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid) goto out; } -/* if new SMB3.11 POSIX extensions are supported do not remap / and \ */ -if (tcon->posix_extensions) - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_POSIX_PATHS ; -if (cap_unix (ses))reset_cifs_unix_caps (0 , tcon,NULL , vol_info);
Signature · 1 line
2.27.0
these and the two others (one from one) recently posted tentatively merged into cifs-2.6.git for-next pending review and testing
http://smb3-test-rhel-75.southcentralus.cloudapp.azure.com/#/builders/5/builds/73
Quoted 12 lines · Paul Aurich
Ensure several mount parameters work properly on multiuser mounts for non-root users, and add the user ID / credentials user ID to the session output in DebugData.
Note that the 'posix' fix is speculative, as I don't currently have a server instance that supports SMB2 posix extensions.
Regards,
~Paul
Signature · 3 lines
Thanks, Steve
Aurélien Aptel
Reviewed-byThanks Paul!
All changes looks good to me and I think could be squashed into 1
commit: they are all adjusting the volume info used to mount from the master tcon, all in the same func.
Quoted 2 lines · Steve French
these and the two others (one from one) recently posted tentatively merged into cifs-2.6.git for-next pending review and testing
I don't think we have any multiuser tests, sadly :(
Cheers,
Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
Quoted 5 lines · Aurélien Aptel
Thanks Paul!
All changes looks good to me and I think could be squashed into 1
commit: they are all adjusting the volume info used to mount from the master tcon, all in the same func.
I kept them separate just because they may have different applicability to stable branches. As I wrote that, though, I realized I didn't test/check if they'd apply or not (because of ordering).
I don't mind if they're squashed. (I can do that and resend if needed.)
Quoted 15 lines
Reviewed-by Aurelien Aptel <[email protected]>Quoted 2 lines · Steve French
these and the two others (one from one) recently posted tentatively merged into cifs-2.6.git for-next pending review and testing
I don't think we have any multiuser tests, sadly :(
Cheers,
Signature · 4 lines
Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
~Paul