diff options
author | Paulo Alcantara <pc@manguebit.com> | 2023-08-17 18:34:09 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-08-21 00:05:50 +0300 |
commit | a18280e7fdea1f2f0736c45f9fee27eccd3998ae (patch) | |
tree | a6650aa7c8f70dc1146994a4ff6e01e5806743f9 /fs/smb/client/namespace.c | |
parent | f2762ae4d3e0bceeabfac4bc3c53700d80a602c9 (diff) | |
download | linux-a18280e7fdea1f2f0736c45f9fee27eccd3998ae.tar.xz |
smb: cilent: set reparse mount points as automounts
By doing so we can selectively mark those submounts as 'noserverino'
rather than whole mount and thus avoiding inode collisions in them.
Consider a "test" SMB share that has two mounted NTFS volumes
(vol0 & vol1) inside it.
* Before patch
$ mount.cifs //srv/test /mnt/1 -o ...,serverino
$ ls -li /mnt/1/vol0
total 1
281474976710693 drwxr-xr-x 2 root root 0 Jul 15 00:23 $RECYCLE.BIN
281474976710696 drwxr-xr-x 2 root root 0 Jul 18 18:23 System Volume...
281474976710699 -rwxr-xr-x 1 root root 0 Aug 14 21:53 f0
281474976710700 -rwxr-xr-x 1 root root 0 Aug 15 18:52 f2
281474976710698 drwxr-xr-x 2 root root 0 Aug 12 19:39 foo
281474976710692 -rwxr-xr-x 1 root root 5 Aug 4 21:18 vol0_f0.txt
$ ls -li /mnt/1/vol1
total 0
281474976710693 drwxr-xr-x 2 root root 0 Jul 15 00:23 $RECYCLE.BIN
281474976710696 drwxr-xr-x 2 root root 0 Jul 18 18:23 System Volume...
281474976710698 drwxr-xr-x 2 root root 0 Aug 12 19:39 bar
281474976710699 -rwxr-xr-x 1 root root 0 Aug 14 22:03 f0
281474976710700 -rwxr-xr-x 1 root root 0 Aug 14 22:52 f1
281474976710692 -rwxr-xr-x 1 root root 0 Jul 15 00:23 vol1_f0.txt
* After patch
$ mount.cifs //srv/test /mnt/1 -o ...,serverino
$ ls -li /mnt/1/vol0
total 1
590 drwxr-xr-x 2 root root 0 Jul 15 00:23 $RECYCLE.BIN
594 drwxr-xr-x 2 root root 0 Jul 18 18:23 System Volume Information
591 -rwxr-xr-x 1 root root 0 Aug 14 21:53 f0
592 -rwxr-xr-x 1 root root 0 Aug 15 18:52 f2
593 drwxr-xr-x 2 root root 0 Aug 12 19:39 foo
595 -rwxr-xr-x 1 root root 5 Aug 4 21:18 vol0_f0.txt
$ ls -li /mnt/1/vol1
total 0
596 drwxr-xr-x 2 root root 0 Jul 15 00:23 $RECYCLE.BIN
600 drwxr-xr-x 2 root root 0 Jul 18 18:23 System Volume Information
597 drwxr-xr-x 2 root root 0 Aug 12 19:39 bar
598 -rwxr-xr-x 1 root root 0 Aug 14 22:03 f0
599 -rwxr-xr-x 1 root root 0 Aug 14 22:52 f1
601 -rwxr-xr-x 1 root root 0 Jul 15 00:23 vol1_f0.txt
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/namespace.c')
-rw-r--r-- | fs/smb/client/namespace.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/fs/smb/client/namespace.c b/fs/smb/client/namespace.c index 3252fe33f7a3..c8f5ed8a69f1 100644 --- a/fs/smb/client/namespace.c +++ b/fs/smb/client/namespace.c @@ -126,9 +126,11 @@ static char *automount_fullpath(struct dentry *dentry, void *page) char *s; spin_lock(&tcon->tc_lock); - if (unlikely(!tcon->origin_fullpath)) { + if (!tcon->origin_fullpath) { spin_unlock(&tcon->tc_lock); - return ERR_PTR(-EREMOTE); + return build_path_from_dentry_optional_prefix(dentry, + page, + true); } spin_unlock(&tcon->tc_lock); @@ -162,7 +164,6 @@ static struct vfsmount *cifs_do_automount(struct path *path) int rc; struct dentry *mntpt = path->dentry; struct fs_context *fc; - struct cifs_sb_info *cifs_sb; void *page = NULL; struct smb3_fs_context *ctx, *cur_ctx; struct smb3_fs_context tmp; @@ -172,17 +173,7 @@ static struct vfsmount *cifs_do_automount(struct path *path) if (IS_ROOT(mntpt)) return ERR_PTR(-ESTALE); - /* - * The MSDFS spec states that paths in DFS referral requests and - * responses must be prefixed by a single '\' character instead of - * the double backslashes usually used in the UNC. This function - * gives us the latter, so we must adjust the result. - */ - cifs_sb = CIFS_SB(mntpt->d_sb); - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_DFS) - return ERR_PTR(-EREMOTE); - - cur_ctx = cifs_sb->ctx; + cur_ctx = CIFS_SB(mntpt->d_sb)->ctx; fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, mntpt); if (IS_ERR(fc)) |