cifs: include regular shares to the list of unshared tcp servers
Subsystems (2)
PATCH 1/1 cifs: include regular shares to the list of unshared tcp servers
We need to make regular shares to also not share tcp servers because we might have both regular and dfs mounts connecting to same server.
--- fs/cifs/connect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/cifs/connect.c +6 -2
@@ -3382,6 +3382,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)char *oldmnt =NULL ;bool ref_server = false; +/* +* Do not share tcp servers when CONFIG_CIFS_DFS_UPCALL option is enabled to properly handle +* reconnect of regular and dfs shares when they were connected to same server. +*/ + ctx->nosharesock = true; + rc =mount_get_conns (ctx, cifs_sb, &xid, &server, &ses, &tcon);/* * If called with 'nodfs' mount option, then skip DFS resolving. Otherwise unconditionally
@@ -3403,8 +3409,6 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) goto error; } - ctx->nosharesock = true; -/* Get path of DFS root */ ref_path =build_unc_path_to_root (ctx, cifs_sb, false);if (IS_ERR (ref_path)) {
Signature · 1 line
2.32.0
Quoted 2 lines · Paulo Alcantara
We need to make regular shares to also not share tcp servers because we might have both regular and dfs mounts connecting to same server.
So with this change we never reuse tcp connections, and nosharesock because the default mount option for all cases. We might as well remove all the code for searching/matching/reusing tcp connection, smb session, tree connects.
That doesn't seem good. If dfs connections are made with the nosharesock flag they should not be reused already no?
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 8 lines · Aurélien Aptel
Quoted 2 lines · Paulo Alcantara
We need to make regular shares to also not share tcp servers because we might have both regular and dfs mounts connecting to same server.
So with this change we never reuse tcp connections, and nosharesock because the default mount option for all cases. We might as well remove all the code for searching/matching/reusing tcp connection, smb session, tree connects.
Sounds like a good idea, yes. Of course, if we really want to do this regardless CONFIG_CIFS_DFS_UPCALL, it would probably be better off doing it in a separate series.
Quoted 2 lines
That doesn't seem good. If dfs connections are made with the nosharesock flag they should not be reused already no?
The previous version only made sure to not share tcp servers among DFS shares, however, we must do it for all shares when we have CONFIG_CIFS_DFS_UPCALL option enabled.
Without this change, the following would occur:
mount //dfsroot/dfs (new tcp)
mount //dfsroot/share (reuse tcp because
rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
/*
* If called with 'nodfs' mount option, then skip DFS resolving. Otherwise unconditionally
* try to get an DFS referral (even cached) to determine whether it is an DFS mount.
*
* Skip prefix path to provide support for DFS referrals from w2k8 servers which don't seem
* to respond with PATH_NOT_COVERED to requests that include the prefix.
*/
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) ||
dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), ctx->UNC + 1, NULL,
NULL)) {
if (rc)
goto error;
/* Check if it is fully accessible and then mount it */
rc = is_path_remote(cifs_sb, ctx, xid, server, tcon);
if (!rc)
goto out;
if (rc != -EREMOTE)
goto error;
}would get executed in cifs_mount() and we only set nosharesock after that)
With this patch:
mount //dfsroot/dfs (new tcp)
mount //dfsroot/share (new tcp)