diff options
Diffstat (limited to 'fs/fat/namei_vfat.c')
-rw-r--r-- | fs/fat/namei_vfat.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index f565f24019b5..411c192a05fa 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -701,6 +701,15 @@ static int vfat_find(struct inode *dir, struct qstr *qname, | |||
701 | return fat_search_long(dir, qname->name, len, sinfo); | 701 | return fat_search_long(dir, qname->name, len, sinfo); |
702 | } | 702 | } |
703 | 703 | ||
704 | /* | ||
705 | * (nfsd's) anonymous disconnected dentry? | ||
706 | * NOTE: !IS_ROOT() is not anonymous (I.e. d_splice_alias() did the job). | ||
707 | */ | ||
708 | static int vfat_d_anon_disconn(struct dentry *dentry) | ||
709 | { | ||
710 | return IS_ROOT(dentry) && (dentry->d_flags & DCACHE_DISCONNECTED); | ||
711 | } | ||
712 | |||
704 | static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | 713 | static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, |
705 | struct nameidata *nd) | 714 | struct nameidata *nd) |
706 | { | 715 | { |
@@ -729,11 +738,11 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
729 | } | 738 | } |
730 | 739 | ||
731 | alias = d_find_alias(inode); | 740 | alias = d_find_alias(inode); |
732 | if (alias && !(alias->d_flags & DCACHE_DISCONNECTED)) { | 741 | if (alias && !vfat_d_anon_disconn(alias)) { |
733 | /* | 742 | /* |
734 | * This inode has non DCACHE_DISCONNECTED dentry. This | 743 | * This inode has non anonymous-DCACHE_DISCONNECTED |
735 | * means, the user did ->lookup() by an another name | 744 | * dentry. This means, the user did ->lookup() by an |
736 | * (longname vs 8.3 alias of it) in past. | 745 | * another name (longname vs 8.3 alias of it) in past. |
737 | * | 746 | * |
738 | * Switch to new one for reason of locality if possible. | 747 | * Switch to new one for reason of locality if possible. |
739 | */ | 748 | */ |
@@ -743,7 +752,9 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry, | |||
743 | iput(inode); | 752 | iput(inode); |
744 | unlock_super(sb); | 753 | unlock_super(sb); |
745 | return alias; | 754 | return alias; |
746 | } | 755 | } else |
756 | dput(alias); | ||
757 | |||
747 | out: | 758 | out: |
748 | unlock_super(sb); | 759 | unlock_super(sb); |
749 | dentry->d_op = sb->s_root->d_op; | 760 | dentry->d_op = sb->s_root->d_op; |