]> git.karo-electronics.de Git - linux-beck.git/blobdiff - fs/ecryptfs/dentry.c
Merge tag 'dm-4.9-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[linux-beck.git] / fs / ecryptfs / dentry.c
index 8db0b464483f9b028f78e779a8337c3d33ca1c64..63cd2c147221aae7c83d2f8992994c625fdcea67 100644 (file)
 static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
 {
        struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
-       int rc;
-
-       if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE))
-               return 1;
+       int rc = 1;
 
        if (flags & LOOKUP_RCU)
                return -ECHILD;
 
-       rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
+       if (lower_dentry->d_flags & DCACHE_OP_REVALIDATE)
+               rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
+
        if (d_really_is_positive(dentry)) {
-               struct inode *lower_inode =
-                       ecryptfs_inode_to_lower(d_inode(dentry));
+               struct inode *inode = d_inode(dentry);
 
-               fsstack_copy_attr_all(d_inode(dentry), lower_inode);
+               fsstack_copy_attr_all(inode, ecryptfs_inode_to_lower(inode));
+               if (!inode->i_nlink)
+                       return 0;
        }
        return rc;
 }