diff options
Diffstat (limited to 'fs/ecryptfs/dentry.c')
-rw-r--r-- | fs/ecryptfs/dentry.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 46e31c92e574..8cefa8e13bcc 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -44,15 +44,15 @@ | |||
44 | */ | 44 | */ |
45 | static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) | 45 | static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) |
46 | { | 46 | { |
47 | struct dentry *lower_dentry; | 47 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
48 | int rc = 1; | 48 | int rc; |
49 | |||
50 | if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE)) | ||
51 | return 1; | ||
49 | 52 | ||
50 | if (flags & LOOKUP_RCU) | 53 | if (flags & LOOKUP_RCU) |
51 | return -ECHILD; | 54 | return -ECHILD; |
52 | 55 | ||
53 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
54 | if (!(lower_dentry->d_flags & DCACHE_OP_REVALIDATE)) | ||
55 | goto out; | ||
56 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); | 56 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); |
57 | if (dentry->d_inode) { | 57 | if (dentry->d_inode) { |
58 | struct inode *lower_inode = | 58 | struct inode *lower_inode = |
@@ -60,12 +60,17 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) | |||
60 | 60 | ||
61 | fsstack_copy_attr_all(dentry->d_inode, lower_inode); | 61 | fsstack_copy_attr_all(dentry->d_inode, lower_inode); |
62 | } | 62 | } |
63 | out: | ||
64 | return rc; | 63 | return rc; |
65 | } | 64 | } |
66 | 65 | ||
67 | struct kmem_cache *ecryptfs_dentry_info_cache; | 66 | struct kmem_cache *ecryptfs_dentry_info_cache; |
68 | 67 | ||
68 | static void ecryptfs_dentry_free_rcu(struct rcu_head *head) | ||
69 | { | ||
70 | kmem_cache_free(ecryptfs_dentry_info_cache, | ||
71 | container_of(head, struct ecryptfs_dentry_info, rcu)); | ||
72 | } | ||
73 | |||
69 | /** | 74 | /** |
70 | * ecryptfs_d_release | 75 | * ecryptfs_d_release |
71 | * @dentry: The ecryptfs dentry | 76 | * @dentry: The ecryptfs dentry |
@@ -74,15 +79,12 @@ struct kmem_cache *ecryptfs_dentry_info_cache; | |||
74 | */ | 79 | */ |
75 | static void ecryptfs_d_release(struct dentry *dentry) | 80 | static void ecryptfs_d_release(struct dentry *dentry) |
76 | { | 81 | { |
77 | if (ecryptfs_dentry_to_private(dentry)) { | 82 | struct ecryptfs_dentry_info *p = dentry->d_fsdata; |
78 | if (ecryptfs_dentry_to_lower(dentry)) { | 83 | if (p) { |
79 | dput(ecryptfs_dentry_to_lower(dentry)); | 84 | if (p->lower_path.dentry) |
80 | mntput(ecryptfs_dentry_to_lower_mnt(dentry)); | 85 | path_put(&p->lower_path); |
81 | } | 86 | call_rcu(&p->rcu, ecryptfs_dentry_free_rcu); |
82 | kmem_cache_free(ecryptfs_dentry_info_cache, | ||
83 | ecryptfs_dentry_to_private(dentry)); | ||
84 | } | 87 | } |
85 | return; | ||
86 | } | 88 | } |
87 | 89 | ||
88 | const struct dentry_operations ecryptfs_dops = { | 90 | const struct dentry_operations ecryptfs_dops = { |