aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/dentry.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
commit9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch)
treedd0a1b3396ae9414f668b0110cc39d11268ad3ed /fs/ecryptfs/dentry.c
parentf0230294271f511b41797305b685365a9e569a09 (diff)
parentbdd3536618443809d18868563eeafa63b9d29603 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "All kinds of stuff this time around; some more notable parts: - RCU'd vfsmounts handling - new primitives for coredump handling - files_lock is gone - Bruce's delegations handling series - exportfs fixes plus misc stuff all over the place" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits) ecryptfs: ->f_op is never NULL locks: break delegations on any attribute modification locks: break delegations on link locks: break delegations on rename locks: helper functions for delegation breaking locks: break delegations on unlink namei: minor vfs_unlink cleanup locks: implement delegations locks: introduce new FL_DELEG lock flag vfs: take i_mutex on renamed file vfs: rename I_MUTEX_QUOTA now that it's not used for quotas vfs: don't use PARENT/CHILD lock classes for non-directories vfs: pull ext4's double-i_mutex-locking into common code exportfs: fix quadratic behavior in filehandle lookup exportfs: better variable name exportfs: move most of reconnect_path to helper function exportfs: eliminate unused "noprogress" counter exportfs: stop retrying once we race with rename/remove exportfs: clear DISCONNECTED on all parents sooner exportfs: more detailed comment for path_reconnect ...
Diffstat (limited to 'fs/ecryptfs/dentry.c')
-rw-r--r--fs/ecryptfs/dentry.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index bf12ba5dd223..4000f6b3a750 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -44,15 +44,15 @@
44 */ 44 */
45static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) 45static 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_op || !lower_dentry->d_op->d_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 }
63out:
64 return rc; 63 return rc;
65} 64}
66 65
67struct kmem_cache *ecryptfs_dentry_info_cache; 66struct kmem_cache *ecryptfs_dentry_info_cache;
68 67
68static 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,11 @@ struct kmem_cache *ecryptfs_dentry_info_cache;
74 */ 79 */
75static void ecryptfs_d_release(struct dentry *dentry) 80static 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 path_put(&p->lower_path);
80 mntput(ecryptfs_dentry_to_lower_mnt(dentry)); 85 call_rcu(&p->rcu, ecryptfs_dentry_free_rcu);
81 }
82 kmem_cache_free(ecryptfs_dentry_info_cache,
83 ecryptfs_dentry_to_private(dentry));
84 } 86 }
85 return;
86} 87}
87 88
88const struct dentry_operations ecryptfs_dops = { 89const struct dentry_operations ecryptfs_dops = {