Commit 936ad909 authored by Ian Kent's avatar Ian Kent Committed by Steve French

cifs - check S_AUTOMOUNT in revalidate

When revalidating a dentry, if the inode wasn't known to be a dfs
entry when the dentry was instantiated, such as when created via
->readdir(), the DCACHE_NEED_AUTOMOUNT flag needs to be set on the
dentry in ->d_revalidate().

The false return from cifs_d_revalidate(), due to the inode now
being marked with the S_AUTOMOUNT flag, might not invalidate the
dentry if there is a concurrent unlazy path walk. This is because
the dentry reference count will be at least 2 in this case causing
d_invalidate() to return EBUSY. So the asumption that the dentry
will be discarded then correctly instantiated via ->lookup() might
not hold.
Signed-off-by: default avatarIan Kent <raven@themaw.net>
Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
Cc: Steve French <smfrench@gmail.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 58fa015f
...@@ -668,12 +668,19 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) ...@@ -668,12 +668,19 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
return 0; return 0;
else { else {
/* /*
* Forcibly invalidate automounting directory inodes * If the inode wasn't known to be a dfs entry when
* (remote DFS directories) so to have them * the dentry was instantiated, such as when created
* instantiated again for automount * via ->readdir(), it needs to be set now since the
* attributes will have been updated by
* cifs_revalidate_dentry().
*/ */
if (IS_AUTOMOUNT(direntry->d_inode)) if (IS_AUTOMOUNT(direntry->d_inode) &&
return 0; !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) {
spin_lock(&direntry->d_lock);
direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;
spin_unlock(&direntry->d_lock);
}
return 1; return 1;
} }
} }
......
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