Skip to content

Commit 5716236

Browse files
committed
Merge tag '6.13-rc6-SMB3-client-fix' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fix from Steve French: - fix unneeded session setup retry due to stale password e.g. for DFS automounts * tag '6.13-rc6-SMB3-client-fix' of git://git.samba.org/sfrench/cifs-2.6: smb: client: sync the root session and superblock context passwords before automounting
2 parents da60d15 + 20b1aa9 commit 5716236

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

fs/smb/client/namespace.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,28 @@ static struct vfsmount *cifs_do_automount(struct path *path)
196196
struct smb3_fs_context tmp;
197197
char *full_path;
198198
struct vfsmount *mnt;
199+
struct cifs_sb_info *mntpt_sb;
200+
struct cifs_ses *ses;
199201

200202
if (IS_ROOT(mntpt))
201203
return ERR_PTR(-ESTALE);
202204

203-
cur_ctx = CIFS_SB(mntpt->d_sb)->ctx;
205+
mntpt_sb = CIFS_SB(mntpt->d_sb);
206+
ses = cifs_sb_master_tcon(mntpt_sb)->ses;
207+
cur_ctx = mntpt_sb->ctx;
208+
209+
/*
210+
* At this point, the root session should be in the mntpt sb. We should
211+
* bring the sb context passwords in sync with the root session's
212+
* passwords. This would help prevent unnecessary retries and password
213+
* swaps for automounts.
214+
*/
215+
mutex_lock(&ses->session_mutex);
216+
rc = smb3_sync_session_ctx_passwords(mntpt_sb, ses);
217+
mutex_unlock(&ses->session_mutex);
218+
219+
if (rc)
220+
return ERR_PTR(rc);
204221

205222
fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, mntpt);
206223
if (IS_ERR(fc))

0 commit comments

Comments
 (0)