Commit a18280e7 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

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: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent f2762ae4
...@@ -1094,7 +1094,7 @@ cap_unix(struct cifs_ses *ses) ...@@ -1094,7 +1094,7 @@ cap_unix(struct cifs_ses *ses)
* inode with new info * inode with new info
*/ */
#define CIFS_FATTR_DFS_REFERRAL 0x1 #define CIFS_FATTR_JUNCTION 0x1
#define CIFS_FATTR_DELETE_PENDING 0x2 #define CIFS_FATTR_DELETE_PENDING 0x2
#define CIFS_FATTR_NEED_REVAL 0x4 #define CIFS_FATTR_NEED_REVAL 0x4
#define CIFS_FATTR_INO_COLLISION 0x8 #define CIFS_FATTR_INO_COLLISION 0x8
......
This diff is collapsed.
...@@ -126,9 +126,11 @@ static char *automount_fullpath(struct dentry *dentry, void *page) ...@@ -126,9 +126,11 @@ static char *automount_fullpath(struct dentry *dentry, void *page)
char *s; char *s;
spin_lock(&tcon->tc_lock); spin_lock(&tcon->tc_lock);
if (unlikely(!tcon->origin_fullpath)) { if (!tcon->origin_fullpath) {
spin_unlock(&tcon->tc_lock); spin_unlock(&tcon->tc_lock);
return ERR_PTR(-EREMOTE); return build_path_from_dentry_optional_prefix(dentry,
page,
true);
} }
spin_unlock(&tcon->tc_lock); spin_unlock(&tcon->tc_lock);
...@@ -162,7 +164,6 @@ static struct vfsmount *cifs_do_automount(struct path *path) ...@@ -162,7 +164,6 @@ static struct vfsmount *cifs_do_automount(struct path *path)
int rc; int rc;
struct dentry *mntpt = path->dentry; struct dentry *mntpt = path->dentry;
struct fs_context *fc; struct fs_context *fc;
struct cifs_sb_info *cifs_sb;
void *page = NULL; void *page = NULL;
struct smb3_fs_context *ctx, *cur_ctx; struct smb3_fs_context *ctx, *cur_ctx;
struct smb3_fs_context tmp; struct smb3_fs_context tmp;
...@@ -172,17 +173,7 @@ static struct vfsmount *cifs_do_automount(struct path *path) ...@@ -172,17 +173,7 @@ static struct vfsmount *cifs_do_automount(struct path *path)
if (IS_ROOT(mntpt)) if (IS_ROOT(mntpt))
return ERR_PTR(-ESTALE); return ERR_PTR(-ESTALE);
/* cur_ctx = CIFS_SB(mntpt->d_sb)->ctx;
* 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;
fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, mntpt); fc = fs_context_for_submount(path->mnt->mnt_sb->s_type, mntpt);
if (IS_ERR(fc)) if (IS_ERR(fc))
......
...@@ -143,6 +143,7 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr) ...@@ -143,6 +143,7 @@ static bool reparse_file_needs_reval(const struct cifs_fattr *fattr)
case IO_REPARSE_TAG_DFSR: case IO_REPARSE_TAG_DFSR:
case IO_REPARSE_TAG_SYMLINK: case IO_REPARSE_TAG_SYMLINK:
case IO_REPARSE_TAG_NFS: case IO_REPARSE_TAG_NFS:
case IO_REPARSE_TAG_MOUNT_POINT:
case 0: case 0:
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment