diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2015-04-02 09:51:35 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2015-05-10 20:56:05 -0400 |
commit | f5d0684e848f01347ba510545822c205889f8acc (patch) | |
tree | c2df58040da189ea3d8652dd890e535734f70cd1 /fs/cifs | |
parent | 030bbdbf4c833bc69f502eae58498bc5572db736 (diff) |
cifs: Don't replace dentries for dfs mounts
Doing a readdir on a dfs root can result in the dentries for directories
with a dfs share mounted being replaced by new dentries for objects
returned by the readdir call. These new dentries on shares mounted with
unix extenstions show up as symlinks pointing to the dfs share.
# mount -t cifs -o sec=none //vm140-31/dfsroot cifs
# stat cifs/testlink/testfile; ls -l cifs
File: ‘cifs/testlink/testfile’
Size: 0 Blocks: 0 IO Block: 16384 regular
empty file
Device: 27h/39d Inode: 130120 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2015-03-31 13:55:50.106018200 +0100
Modify: 2015-03-31 13:55:50.106018200 +0100
Change: 2015-03-31 13:55:50.106018200 +0100
Birth: -
total 0
drwxr-xr-x 2 root root 0 Mar 31 13:54 testdir
lrwxrwxrwx 1 root root 19 Mar 24 14:25 testlink -> \vm140-31\test
In the example above, the stat command mounts the dfs share at
cifs/testlink. The subsequent ls on the dfsroot directory replaces the
dentry for testlink with a symlink.
In the earlier code, the d_invalidate command returned an -EBUSY error
when attempting to invalidate directories. This stopped the code from
replacing the directories with symlinks returned by the readdir call.
Changes were recently made to the d_invalidate() command so
that it no longer returns an error code. This results in the directory
with the mounted dfs share being replaced by a symlink which denotes a
dfs share.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/readdir.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index b4a47237486b..b1eede3678a9 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -90,6 +90,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
90 | if (dentry) { | 90 | if (dentry) { |
91 | inode = d_inode(dentry); | 91 | inode = d_inode(dentry); |
92 | if (inode) { | 92 | if (inode) { |
93 | if (d_mountpoint(dentry)) | ||
94 | goto out; | ||
93 | /* | 95 | /* |
94 | * If we're generating inode numbers, then we don't | 96 | * If we're generating inode numbers, then we don't |
95 | * want to clobber the existing one with the one that | 97 | * want to clobber the existing one with the one that |