Skip to contentSkip to conversation

Various fixes for multiuser SMB mounts

PATCH In review Paul Aurich 3 participants 10 messages Jun 26, 2020 – Jun 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index fc98b97b396a..53588d7517b4 100644
@@ -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
#2 lore raw

PATCH 2/6 SMB3: Honor 'seal' flag for multiuser mounts

In reply to Paul Aurich

Ensure 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
index 5fac34f192af..804509f7f3a1 100644
@@ -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
#3 lore raw

PATCH 3/6 SMB3: Honor persistent/resilient handle flags for multiuser mounts

In reply to Paul Aurich

Without 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
index 804509f7f3a1..dc7f875d2caf 100644
@@ -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
#4 lore raw

PATCH 4/6 SMB3: Honor lease disabling for multiuser mounts

In reply to Paul Aurich
Fixes 3e7a02d47872 ("smb3: allow disabling requesting leases")
CC Stable <[email protected]>
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
index dc7f875d2caf..6e71a1578e34 100644
@@ -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
#5 lore raw

PATCH 5/6 SMB3: Honor 'handletimeout' flag for multiuser mounts

In reply to Paul Aurich
Fixes ca567eb2b3f0 ("SMB3: Allow persistent handle timeout to be configurable on mount")
CC Stable <[email protected]>
---
 fs/cifs/connect.c | 1 +
 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
index 6e71a1578e34..dada6d51e034 100644
@@ -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
#6 lore raw

PATCH 6/6 SMB3: Honor 'posix' flag for multiuser mounts

In reply to Paul Aurich

The 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.

Fixes ce558b0e17f8 ("smb3: Add posix create context for smb3.11 posix mounts")
Fixes b326614ea215 ("smb3: allow "posix" mount option to enable new SMB311 protocol extensions")
---
 fs/cifs/connect.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/cifs/connect.c +1 -4
index dada6d51e034..a61abde09ffe 100644
@@ -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
#7 lore raw
In reply to Paul Aurich

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
Reviewed-by
#8 lore raw

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.

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)
#9 lore raw
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
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