diff options
-rw-r--r-- | fs/ecryptfs/dentry.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 6 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 2 | ||||
-rw-r--r-- | fs/stack.c | 17 | ||||
-rw-r--r-- | include/linux/fs_stack.h | 4 |
5 files changed, 9 insertions, 22 deletions
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 2dda5ade75bc..8f006a0d6076 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -62,7 +62,7 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
62 | struct inode *lower_inode = | 62 | struct inode *lower_inode = |
63 | ecryptfs_inode_to_lower(dentry->d_inode); | 63 | ecryptfs_inode_to_lower(dentry->d_inode); |
64 | 64 | ||
65 | fsstack_copy_attr_all(dentry->d_inode, lower_inode, NULL); | 65 | fsstack_copy_attr_all(dentry->d_inode, lower_inode); |
66 | } | 66 | } |
67 | out: | 67 | out: |
68 | return rc; | 68 | return rc; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 056fed62d0de..429ca0b3ba08 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -626,9 +626,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
626 | lower_new_dir_dentry->d_inode, lower_new_dentry); | 626 | lower_new_dir_dentry->d_inode, lower_new_dentry); |
627 | if (rc) | 627 | if (rc) |
628 | goto out_lock; | 628 | goto out_lock; |
629 | fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode, NULL); | 629 | fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode); |
630 | if (new_dir != old_dir) | 630 | if (new_dir != old_dir) |
631 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode, NULL); | 631 | fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode); |
632 | out_lock: | 632 | out_lock: |
633 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); | 633 | unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry); |
634 | dput(lower_new_dentry->d_parent); | 634 | dput(lower_new_dentry->d_parent); |
@@ -967,7 +967,7 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
967 | rc = notify_change(lower_dentry, ia); | 967 | rc = notify_change(lower_dentry, ia); |
968 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | 968 | mutex_unlock(&lower_dentry->d_inode->i_mutex); |
969 | out: | 969 | out: |
970 | fsstack_copy_attr_all(inode, lower_inode, NULL); | 970 | fsstack_copy_attr_all(inode, lower_inode); |
971 | return rc; | 971 | return rc; |
972 | } | 972 | } |
973 | 973 | ||
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 101fe4c7b1ee..567bc4b9f70a 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 | init_special_inode(inode, lower_inode->i_mode, | 189 | init_special_inode(inode, lower_inode->i_mode, |
190 | lower_inode->i_rdev); | 190 | lower_inode->i_rdev); |
191 | dentry->d_op = &ecryptfs_dops; | 191 | dentry->d_op = &ecryptfs_dops; |
192 | fsstack_copy_attr_all(inode, lower_inode, NULL); | 192 | fsstack_copy_attr_all(inode, lower_inode); |
193 | /* This size will be overwritten for real files w/ headers and | 193 | /* This size will be overwritten for real files w/ headers and |
194 | * other metadata */ | 194 | * other metadata */ |
195 | fsstack_copy_inode_size(inode, lower_inode); | 195 | fsstack_copy_inode_size(inode, lower_inode); |
diff --git a/fs/stack.c b/fs/stack.c index 67716f6a1a4a..0e20e43ad740 100644 --- a/fs/stack.c +++ b/fs/stack.c | |||
@@ -14,11 +14,8 @@ void fsstack_copy_inode_size(struct inode *dst, const struct inode *src) | |||
14 | } | 14 | } |
15 | EXPORT_SYMBOL_GPL(fsstack_copy_inode_size); | 15 | EXPORT_SYMBOL_GPL(fsstack_copy_inode_size); |
16 | 16 | ||
17 | /* copy all attributes; get_nlinks is optional way to override the i_nlink | 17 | /* copy all attributes */ |
18 | * copying | 18 | void fsstack_copy_attr_all(struct inode *dest, const struct inode *src) |
19 | */ | ||
20 | void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | ||
21 | int (*get_nlinks)(struct inode *)) | ||
22 | { | 19 | { |
23 | dest->i_mode = src->i_mode; | 20 | dest->i_mode = src->i_mode; |
24 | dest->i_uid = src->i_uid; | 21 | dest->i_uid = src->i_uid; |
@@ -29,14 +26,6 @@ void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | |||
29 | dest->i_ctime = src->i_ctime; | 26 | dest->i_ctime = src->i_ctime; |
30 | dest->i_blkbits = src->i_blkbits; | 27 | dest->i_blkbits = src->i_blkbits; |
31 | dest->i_flags = src->i_flags; | 28 | dest->i_flags = src->i_flags; |
32 | 29 | dest->i_nlink = src->i_nlink; | |
33 | /* | ||
34 | * Update the nlinks AFTER updating the above fields, because the | ||
35 | * get_links callback may depend on them. | ||
36 | */ | ||
37 | if (!get_nlinks) | ||
38 | dest->i_nlink = src->i_nlink; | ||
39 | else | ||
40 | dest->i_nlink = (*get_nlinks)(dest); | ||
41 | } | 30 | } |
42 | EXPORT_SYMBOL_GPL(fsstack_copy_attr_all); | 31 | EXPORT_SYMBOL_GPL(fsstack_copy_attr_all); |
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index bb516ceeefc9..aa60311900dd 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h | |||
@@ -8,9 +8,7 @@ | |||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | 9 | ||
10 | /* externs for fs/stack.c */ | 10 | /* externs for fs/stack.c */ |
11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src); |
12 | int (*get_nlinks)(struct inode *)); | ||
13 | |||
14 | extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src); | 12 | extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src); |
15 | 13 | ||
16 | /* inlines */ | 14 | /* inlines */ |