Unionfs: fix d_revalidate for corner case
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 12 Aug 2014 02:16:32 +0000 (22:16 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 12 Aug 2014 02:16:32 +0000 (22:16 -0400)
In some cases, lower_dentry may goes to NULL.  Return 0 here to mark it
as invalid dentry.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Mengyang Li <li.mengyang@stonybrook.edu>
fs/unionfs/dentry.c

index f5b461dbd80972cc47568a549d42ecb3400f2292..ee5326defa481c352b02174eda0d0c6b234d7f2b 100644 (file)
@@ -316,6 +316,11 @@ static int unionfs_d_revalidate(struct dentry *dentry,
        parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
+       if (!unionfs_lower_dentry(dentry)) {
+               err = 0;
+               goto out;
+       }
+
        valid = __unionfs_d_revalidate(dentry, parent, false);
        if (valid) {
                unionfs_postcopyup_setmnt(dentry);
@@ -324,6 +329,7 @@ static int unionfs_d_revalidate(struct dentry *dentry,
                d_drop(dentry);
                err = valid;
        }
+out:
        unionfs_unlock_dentry(dentry);
        unionfs_unlock_parent(dentry, parent);
        unionfs_read_unlock(dentry->d_sb);