diff options
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r-- | fs/ecryptfs/dentry.c | 9 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 12 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 4 | ||||
-rw-r--r-- | fs/ecryptfs/super.c | 12 |
4 files changed, 27 insertions, 10 deletions
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 906e803f7f79..6fc4f319b550 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -44,12 +44,17 @@ | |||
44 | */ | 44 | */ |
45 | static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) | 45 | static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) |
46 | { | 46 | { |
47 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 47 | struct dentry *lower_dentry; |
48 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 48 | struct vfsmount *lower_mnt; |
49 | struct dentry *dentry_save; | 49 | struct dentry *dentry_save; |
50 | struct vfsmount *vfsmount_save; | 50 | struct vfsmount *vfsmount_save; |
51 | int rc = 1; | 51 | int rc = 1; |
52 | 52 | ||
53 | if (nd->flags & LOOKUP_RCU) | ||
54 | return -ECHILD; | ||
55 | |||
56 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
57 | lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | ||
53 | if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) | 58 | if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) |
54 | goto out; | 59 | goto out; |
55 | dentry_save = nd->path.dentry; | 60 | dentry_save = nd->path.dentry; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 9d1a22d62765..337352a94751 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -260,7 +260,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
260 | ecryptfs_dentry->d_parent)); | 260 | ecryptfs_dentry->d_parent)); |
261 | lower_inode = lower_dentry->d_inode; | 261 | lower_inode = lower_dentry->d_inode; |
262 | fsstack_copy_attr_atime(ecryptfs_dir_inode, lower_dir_dentry->d_inode); | 262 | fsstack_copy_attr_atime(ecryptfs_dir_inode, lower_dir_dentry->d_inode); |
263 | BUG_ON(!atomic_read(&lower_dentry->d_count)); | 263 | BUG_ON(!lower_dentry->d_count); |
264 | ecryptfs_set_dentry_private(ecryptfs_dentry, | 264 | ecryptfs_set_dentry_private(ecryptfs_dentry, |
265 | kmem_cache_alloc(ecryptfs_dentry_info_cache, | 265 | kmem_cache_alloc(ecryptfs_dentry_info_cache, |
266 | GFP_KERNEL)); | 266 | GFP_KERNEL)); |
@@ -441,7 +441,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
441 | struct qstr lower_name; | 441 | struct qstr lower_name; |
442 | int rc = 0; | 442 | int rc = 0; |
443 | 443 | ||
444 | ecryptfs_dentry->d_op = &ecryptfs_dops; | 444 | d_set_d_op(ecryptfs_dentry, &ecryptfs_dops); |
445 | if ((ecryptfs_dentry->d_name.len == 1 | 445 | if ((ecryptfs_dentry->d_name.len == 1 |
446 | && !strcmp(ecryptfs_dentry->d_name.name, ".")) | 446 | && !strcmp(ecryptfs_dentry->d_name.name, ".")) |
447 | || (ecryptfs_dentry->d_name.len == 2 | 447 | || (ecryptfs_dentry->d_name.len == 2 |
@@ -454,7 +454,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
454 | lower_name.hash = ecryptfs_dentry->d_name.hash; | 454 | lower_name.hash = ecryptfs_dentry->d_name.hash; |
455 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | 455 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { |
456 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | 456 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, |
457 | &lower_name); | 457 | lower_dir_dentry->d_inode, &lower_name); |
458 | if (rc < 0) | 458 | if (rc < 0) |
459 | goto out_d_drop; | 459 | goto out_d_drop; |
460 | } | 460 | } |
@@ -489,7 +489,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
489 | lower_name.hash = full_name_hash(lower_name.name, lower_name.len); | 489 | lower_name.hash = full_name_hash(lower_name.name, lower_name.len); |
490 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | 490 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { |
491 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | 491 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, |
492 | &lower_name); | 492 | lower_dir_dentry->d_inode, &lower_name); |
493 | if (rc < 0) | 493 | if (rc < 0) |
494 | goto out_d_drop; | 494 | goto out_d_drop; |
495 | } | 495 | } |
@@ -980,8 +980,10 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
980 | } | 980 | } |
981 | 981 | ||
982 | static int | 982 | static int |
983 | ecryptfs_permission(struct inode *inode, int mask) | 983 | ecryptfs_permission(struct inode *inode, int mask, unsigned int flags) |
984 | { | 984 | { |
985 | if (flags & IPERM_FLAG_RCU) | ||
986 | return -ECHILD; | ||
985 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); | 987 | return inode_permission(ecryptfs_inode_to_lower(inode), mask); |
986 | } | 988 | } |
987 | 989 | ||
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index a9dbd62518e6..351038675376 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -189,7 +189,7 @@ int ecryptfs_interpose(struct dentry *lower_dentry, struct dentry *dentry, | |||
189 | if (special_file(lower_inode->i_mode)) | 189 | if (special_file(lower_inode->i_mode)) |
190 | init_special_inode(inode, lower_inode->i_mode, | 190 | init_special_inode(inode, lower_inode->i_mode, |
191 | lower_inode->i_rdev); | 191 | lower_inode->i_rdev); |
192 | dentry->d_op = &ecryptfs_dops; | 192 | d_set_d_op(dentry, &ecryptfs_dops); |
193 | fsstack_copy_attr_all(inode, lower_inode); | 193 | fsstack_copy_attr_all(inode, lower_inode); |
194 | /* This size will be overwritten for real files w/ headers and | 194 | /* This size will be overwritten for real files w/ headers and |
195 | * other metadata */ | 195 | * other metadata */ |
@@ -594,7 +594,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags | |||
594 | deactivate_locked_super(s); | 594 | deactivate_locked_super(s); |
595 | goto out; | 595 | goto out; |
596 | } | 596 | } |
597 | s->s_root->d_op = &ecryptfs_dops; | 597 | d_set_d_op(s->s_root, &ecryptfs_dops); |
598 | s->s_root->d_sb = s; | 598 | s->s_root->d_sb = s; |
599 | s->s_root->d_parent = s->s_root; | 599 | s->s_root->d_parent = s->s_root; |
600 | 600 | ||
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c index 2720178b7718..3042fe123a34 100644 --- a/fs/ecryptfs/super.c +++ b/fs/ecryptfs/super.c | |||
@@ -62,6 +62,16 @@ out: | |||
62 | return inode; | 62 | return inode; |
63 | } | 63 | } |
64 | 64 | ||
65 | static void ecryptfs_i_callback(struct rcu_head *head) | ||
66 | { | ||
67 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
68 | struct ecryptfs_inode_info *inode_info; | ||
69 | inode_info = ecryptfs_inode_to_private(inode); | ||
70 | |||
71 | INIT_LIST_HEAD(&inode->i_dentry); | ||
72 | kmem_cache_free(ecryptfs_inode_info_cache, inode_info); | ||
73 | } | ||
74 | |||
65 | /** | 75 | /** |
66 | * ecryptfs_destroy_inode | 76 | * ecryptfs_destroy_inode |
67 | * @inode: The ecryptfs inode | 77 | * @inode: The ecryptfs inode |
@@ -88,7 +98,7 @@ static void ecryptfs_destroy_inode(struct inode *inode) | |||
88 | } | 98 | } |
89 | } | 99 | } |
90 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); | 100 | ecryptfs_destroy_crypt_stat(&inode_info->crypt_stat); |
91 | kmem_cache_free(ecryptfs_inode_info_cache, inode_info); | 101 | call_rcu(&inode->i_rcu, ecryptfs_i_callback); |
92 | } | 102 | } |
93 | 103 | ||
94 | /** | 104 | /** |