DFS (smb3 global namespace) client fix

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmeCleEACgkQiiy9cAdy
 T1E47gwAs27hpfbzm+vLPdZFe+Gzz1ELCUpQx+LVad9eM4vDROR0edbHtPqTOHxI
 c8wcafg2jdI4uRR2rsMwaJR+oqWeKPS4InjwkZz02/b18NrVCJReLcUaq/Tkaf3G
 ILVm2JaMw2jq1QADvHbYcrerIu94azYkmVnM2qbBC6eAAEuseHA8Y06mOBlmxxsr
 cuXsh7FHMuUerhyTuo4aLaJ45SToq+X7JAlXBj6cmJwVRVLfzDS8OYqA0ky2AzPK
 knhUgK1uvi3FvuYSkOKxtEeARGeWPKoYUgMoijBB41vItHUb5SDu3AA5M+mUz/SY
 2QrjrNNKVztIF/o5eyNgxqE7JXNCYXXmyEnUMbRkO3QbsqPiRVVU0AI8wrNzLVC+
 ELtz/BTS1j54E4wGZIUfu3Gi45IDjotqpZpcJMIkKoSQFCgDvOePtUnWe6H8WaZb
 oUcCNiR7Zk16w2i5JiiXFbQcA7bRriXB3MwHXix8pZgxyQ+kcrbdnvB1c8G5LwJL
 EJ7lnpzn
 =W51I
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-01-11 10:49:50 -08:00
commit 57162361c3

View File

@ -196,11 +196,28 @@ static struct vfsmount *cifs_do_automount(struct path *path)
struct smb3_fs_context tmp;
char *full_path;
struct vfsmount *mnt;
struct cifs_sb_info *mntpt_sb;
struct cifs_ses *ses;
if (IS_ROOT(mntpt))
return ERR_PTR(-ESTALE);
cur_ctx = CIFS_SB(mntpt->d_sb)->ctx;
mntpt_sb = CIFS_SB(mntpt->d_sb);
ses = cifs_sb_master_tcon(mntpt_sb)->ses;
cur_ctx = mntpt_sb->ctx;
/*
* At this point, the root session should be in the mntpt sb. We should
* bring the sb context passwords in sync with the root session's
* passwords. This would help prevent unnecessary retries and password
* swaps for automounts.
*/
mutex_lock(&ses->session_mutex);
rc = smb3_sync_session_ctx_passwords(mntpt_sb, ses);
mutex_unlock(&ses->session_mutex);
if (rc)
return ERR_PTR(rc);
fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, mntpt);
if (IS_ERR(fc))