diff options
Diffstat (limited to 'fs/reiserfs/xattr.c')
-rw-r--r-- | fs/reiserfs/xattr.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 37d034ca7d99..e7cc00e636dc 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/dcache.h> | 38 | #include <linux/dcache.h> |
39 | #include <linux/namei.h> | 39 | #include <linux/namei.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/gfp.h> | ||
41 | #include <linux/fs.h> | 42 | #include <linux/fs.h> |
42 | #include <linux/file.h> | 43 | #include <linux/file.h> |
43 | #include <linux/pagemap.h> | 44 | #include <linux/pagemap.h> |
@@ -553,7 +554,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
553 | if (!err && new_size < i_size_read(dentry->d_inode)) { | 554 | if (!err && new_size < i_size_read(dentry->d_inode)) { |
554 | struct iattr newattrs = { | 555 | struct iattr newattrs = { |
555 | .ia_ctime = current_fs_time(inode->i_sb), | 556 | .ia_ctime = current_fs_time(inode->i_sb), |
556 | .ia_size = buffer_size, | 557 | .ia_size = new_size, |
557 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 558 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
558 | }; | 559 | }; |
559 | 560 | ||
@@ -972,21 +973,13 @@ int reiserfs_permission(struct inode *inode, int mask) | |||
972 | return generic_permission(inode, mask, NULL); | 973 | return generic_permission(inode, mask, NULL); |
973 | } | 974 | } |
974 | 975 | ||
975 | /* This will catch lookups from the fs root to .reiserfs_priv */ | 976 | static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) |
976 | static int | ||
977 | xattr_lookup_poison(struct dentry *dentry, struct qstr *q1, struct qstr *name) | ||
978 | { | 977 | { |
979 | struct dentry *priv_root = REISERFS_SB(dentry->d_sb)->priv_root; | 978 | return -EPERM; |
980 | if (container_of(q1, struct dentry, d_name) == priv_root) | ||
981 | return -ENOENT; | ||
982 | if (q1->len == name->len && | ||
983 | !memcmp(q1->name, name->name, name->len)) | ||
984 | return 0; | ||
985 | return 1; | ||
986 | } | 979 | } |
987 | 980 | ||
988 | static const struct dentry_operations xattr_lookup_poison_ops = { | 981 | static const struct dentry_operations xattr_lookup_poison_ops = { |
989 | .d_compare = xattr_lookup_poison, | 982 | .d_revalidate = xattr_hide_revalidate, |
990 | }; | 983 | }; |
991 | 984 | ||
992 | int reiserfs_lookup_privroot(struct super_block *s) | 985 | int reiserfs_lookup_privroot(struct super_block *s) |
@@ -1000,8 +993,7 @@ int reiserfs_lookup_privroot(struct super_block *s) | |||
1000 | strlen(PRIVROOT_NAME)); | 993 | strlen(PRIVROOT_NAME)); |
1001 | if (!IS_ERR(dentry)) { | 994 | if (!IS_ERR(dentry)) { |
1002 | REISERFS_SB(s)->priv_root = dentry; | 995 | REISERFS_SB(s)->priv_root = dentry; |
1003 | if (!reiserfs_expose_privroot(s)) | 996 | dentry->d_op = &xattr_lookup_poison_ops; |
1004 | s->s_root->d_op = &xattr_lookup_poison_ops; | ||
1005 | if (dentry->d_inode) | 997 | if (dentry->d_inode) |
1006 | dentry->d_inode->i_flags |= S_PRIVATE; | 998 | dentry->d_inode->i_flags |= S_PRIVATE; |
1007 | } else | 999 | } else |