summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2021-02-11 03:26:54 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-02-26 10:10:28 +0100
commita2c5e4a083a7e24b35b3eb808b760af6de15bac2 (patch)
treea5dadebd3af0863ffa643bb67a6af2ae586558a6
parente6f7bf29e32daebd976c55b9683cf04c3cc2049b (diff)
downloadlinux-stable-a2c5e4a083a7e24b35b3eb808b760af6de15bac2.tar.gz
linux-stable-a2c5e4a083a7e24b35b3eb808b760af6de15bac2.tar.bz2
linux-stable-a2c5e4a083a7e24b35b3eb808b760af6de15bac2.zip
cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
[ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ] While debugging another issue today, Steve and I noticed that if a subdir for a file share is already mounted on the client, any new mount of any other subdir (or the file share root) of the same share results in sharing the cifs superblock, which e.g. can result in incorrect device name. While setting prefix path for the root of a cifs_sb, CIFS_MOUNT_USE_PREFIX_PATH flag should also be set. Without it, prepath is not even considered in some places, and output of "mount" and various /proc/<>/*mount* related options can be missing part of the device name. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/cifs/connect.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ab9eeb5ff8e5..67c2e6487479 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -4198,6 +4198,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
if (cifs_sb->prepath == NULL)
return -ENOMEM;
+ cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
}
return 0;