diff options
author | Ian Kent <raven@themaw.net> | 2012-05-02 07:19:09 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-05-03 14:49:47 -0400 |
commit | 936ad9094462578953042d3395b973f1c9e6fa95 (patch) | |
tree | 22d52c9a2489768a9d70d95ef1a99c78185698c3 | |
parent | 58fa015f611b51e1f501b048bc5ac263c78852f0 (diff) |
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: Ian Kent <raven@themaw.net>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Cc: Steve French <smfrench@gmail.com>
Cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/dir.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d172c8ed9017..ec4e9a2a12f8 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -668,12 +668,19 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) | |||
668 | return 0; | 668 | return 0; |
669 | else { | 669 | else { |
670 | /* | 670 | /* |
671 | * Forcibly invalidate automounting directory inodes | 671 | * If the inode wasn't known to be a dfs entry when |
672 | * (remote DFS directories) so to have them | 672 | * the dentry was instantiated, such as when created |
673 | * instantiated again for automount | 673 | * via ->readdir(), it needs to be set now since the |
674 | * attributes will have been updated by | ||
675 | * cifs_revalidate_dentry(). | ||
674 | */ | 676 | */ |
675 | if (IS_AUTOMOUNT(direntry->d_inode)) | 677 | if (IS_AUTOMOUNT(direntry->d_inode) && |
676 | return 0; | 678 | !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { |
679 | spin_lock(&direntry->d_lock); | ||
680 | direntry->d_flags |= DCACHE_NEED_AUTOMOUNT; | ||
681 | spin_unlock(&direntry->d_lock); | ||
682 | } | ||
683 | |||
677 | return 1; | 684 | return 1; |
678 | } | 685 | } |
679 | } | 686 | } |