diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-27 11:06:05 -0400 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2019-01-29 11:25:42 +0900 |
commit | f4a3eed1d19d4f1421105384c4efa9ffab9a503b (patch) | |
tree | 2589a7e77187f2ce00cd722ac2ab65aa9d2214df /fs | |
parent | 0ef983afec0191daaf9111c571e825c7049de5d2 (diff) | |
download | linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.tar.gz linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.tar.bz2 linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.zip |
switch ->setxattr() to passing dentry and inode separately
commit 3767e255b390d72f9a33c08d9e86c5f21f25860f upstream.
smack ->d_instantiate() uses ->setxattr(), so to be able to call it before
we'd hashed the new dentry and attached it to inode, we need ->setxattr()
instances getting the inode as an explicit argument rather than obtaining
it from dentry.
Similar change for ->getxattr() had been done in commit ce23e64. Unlike
->getxattr() (which is used by both selinux and smack instances of
->d_instantiate()) ->setxattr() is used only by smack one and unfortunately
it got missed back then.
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Tested-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[sw0312.kim: backport from mainline to resolve setxattr crash on smack]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4bf991924e16f61746453b7fd096e5d59438659b
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bad_inode.c | 4 | ||||
-rw-r--r-- | fs/btrfs/xattr.c | 12 | ||||
-rw-r--r-- | fs/btrfs/xattr.h | 5 | ||||
-rw-r--r-- | fs/ceph/super.h | 4 | ||||
-rw-r--r-- | fs/ceph/xattr.c | 7 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 4 | ||||
-rw-r--r-- | fs/cifs/xattr.c | 11 | ||||
-rw-r--r-- | fs/ecryptfs/crypto.c | 9 | ||||
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 4 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 7 | ||||
-rw-r--r-- | fs/ecryptfs/mmap.c | 3 | ||||
-rw-r--r-- | fs/fuse/dir.c | 6 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 9 | ||||
-rw-r--r-- | fs/hfs/attr.c | 6 | ||||
-rw-r--r-- | fs/hfs/hfs_fs.h | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_xattr.h | 4 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 10 | ||||
-rw-r--r-- | fs/kernfs/inode.c | 11 | ||||
-rw-r--r-- | fs/kernfs/kernfs-internal.h | 3 | ||||
-rw-r--r-- | fs/libfs.c | 5 | ||||
-rw-r--r-- | fs/overlayfs/inode.c | 5 | ||||
-rw-r--r-- | fs/overlayfs/overlayfs.h | 5 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 2 | ||||
-rw-r--r-- | fs/ubifs/xattr.c | 6 | ||||
-rw-r--r-- | fs/xattr.c | 8 |
25 files changed, 83 insertions, 69 deletions
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 86df8d475d1f..39e5ba4232bd 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c @@ -100,8 +100,8 @@ static int bad_inode_setattr(struct dentry *direntry, struct iattr *attrs) return -EIO; } -static int bad_inode_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +static int bad_inode_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, int flags) { return -EIO; } diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index a58622a2130b..7e2217a19fa2 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -416,10 +416,11 @@ ssize_t btrfs_getxattr(struct dentry *dentry, struct inode *inode, return __btrfs_getxattr(inode, name, buffer, size); } -int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, +int btrfs_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, int flags) { - struct btrfs_root *root = BTRFS_I(d_inode(dentry))->root; + struct btrfs_root *root = BTRFS_I(inode)->root; int ret; /* @@ -435,20 +436,21 @@ int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) - return generic_setxattr(dentry, name, value, size, flags); + return generic_setxattr(dentry, inode, name, value, + size, flags); ret = btrfs_is_valid_xattr(name); if (ret) return ret; if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) - return btrfs_set_prop(d_inode(dentry), name, + return btrfs_set_prop(inode, name, value, size, flags); if (size == 0) value = ""; /* empty EA, do not remove */ - return __btrfs_setxattr(NULL, d_inode(dentry), name, value, size, + return __btrfs_setxattr(NULL, inode, name, value, size, flags); } diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h index 8ee432942e32..bbd23f3ce456 100644 --- a/fs/btrfs/xattr.h +++ b/fs/btrfs/xattr.h @@ -30,8 +30,9 @@ extern int __btrfs_setxattr(struct btrfs_trans_handle *trans, const void *value, size_t size, int flags); extern ssize_t btrfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size); -extern int btrfs_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags); +extern int btrfs_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, + size_t size, int flags); extern int btrfs_removexattr(struct dentry *dentry, const char *name); extern int btrfs_xattr_security_init(struct btrfs_trans_handle *trans, diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 2793ae2c0ff6..1ae16fee9bf9 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -794,8 +794,8 @@ extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); /* xattr.c */ -extern int ceph_setxattr(struct dentry *, const char *, const void *, - size_t, int); +extern int ceph_setxattr(struct dentry *, struct inode *, const char *, + const void *, size_t, int); int __ceph_setxattr(struct dentry *, const char *, const void *, size_t, int); ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t); int __ceph_removexattr(struct dentry *, const char *); diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 4e4d0b7df85a..bd79a77f9a15 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -1027,14 +1027,15 @@ out: return err; } -int ceph_setxattr(struct dentry *dentry, const char *name, +int ceph_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { - if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP) + if (ceph_snap(inode) != CEPH_NOSNAP) return -EROFS; if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) - return generic_setxattr(dentry, name, value, size, flags); + return generic_setxattr(dentry, inode, name, value, size, + flags); if (size == 0) value = ""; /* empty EA, do not remove */ diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 39c380cd0b90..fbe5f88d6e68 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -122,8 +122,8 @@ extern int cifs_readlink(struct dentry *direntry, char __user *buffer, extern int cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname); extern int cifs_removexattr(struct dentry *, const char *); -extern int cifs_setxattr(struct dentry *, const char *, const void *, - size_t, int); +extern int cifs_setxattr(struct dentry *, struct inode *, const char *, + const void *, size_t, int); extern ssize_t cifs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t); extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 0de08cd2e561..87355a763932 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c @@ -97,8 +97,9 @@ remove_ea_exit: return rc; } -int cifs_setxattr(struct dentry *direntry, const char *ea_name, - const void *ea_value, size_t value_size, int flags) +int cifs_setxattr(struct dentry *direntry, struct inode *inode, + const char *ea_name, const void *ea_value, size_t value_size, + int flags) { int rc = -EOPNOTSUPP; #ifdef CONFIG_CIFS_XATTR @@ -113,7 +114,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, return -EIO; if (d_really_is_negative(direntry)) return -EIO; - sb = d_inode(direntry)->i_sb; + sb = inode->i_sb; if (sb == NULL) return -EIO; @@ -177,12 +178,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, memcpy(pacl, ea_value, value_size); if (pTcon->ses->server->ops->set_acl) rc = pTcon->ses->server->ops->set_acl(pacl, - value_size, d_inode(direntry), + value_size, inode, full_path, CIFS_ACL_DACL); else rc = -EOPNOTSUPP; if (rc == 0) /* force revalidate of the inode */ - CIFS_I(d_inode(direntry))->time = 0; + CIFS_I(inode)->time = 0; kfree(pacl); } #else diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 81701fdedbeb..78c8b6a24968 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -1148,12 +1148,13 @@ ecryptfs_write_metadata_to_contents(struct inode *ecryptfs_inode, static int ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry, + struct inode *ecryptfs_inode, char *page_virt, size_t size) { int rc; - rc = ecryptfs_setxattr(ecryptfs_dentry, ECRYPTFS_XATTR_NAME, page_virt, - size, 0); + rc = ecryptfs_setxattr(ecryptfs_dentry, ecryptfs_inode, + ECRYPTFS_XATTR_NAME, page_virt, size, 0); return rc; } @@ -1222,8 +1223,8 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry, goto out_free; } if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) - rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, virt, - size); + rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, ecryptfs_inode, + virt, size); else rc = ecryptfs_write_metadata_to_contents(ecryptfs_inode, virt, virt_len); diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 7d2e3933ec92..990899934d16 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h @@ -621,8 +621,8 @@ ssize_t ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, const char *name, void *value, size_t size); int -ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, - size_t size, int flags); +ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, + const void *value, size_t size, int flags); int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode); #ifdef CONFIG_ECRYPT_FS_MESSAGING int ecryptfs_process_response(struct ecryptfs_daemon *daemon, diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 6447a9d61ab8..63af5973eb2a 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1012,7 +1012,8 @@ static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, } int -ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, +ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, int flags) { int rc = 0; @@ -1025,8 +1026,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, } rc = vfs_setxattr(lower_dentry, name, value, size, flags); - if (!rc && d_really_is_positive(dentry)) - fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); + if (!rc && inode) + fsstack_copy_attr_all(inode, d_inode(lower_dentry)); out: return rc; } diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index f8863df50ff7..0bc6bfb043e7 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -443,7 +443,8 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) if (size < 0) size = 8; put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt); - rc = lower_inode->i_op->setxattr(lower_dentry, ECRYPTFS_XATTR_NAME, + rc = lower_inode->i_op->setxattr(lower_dentry, lower_inode, + ECRYPTFS_XATTR_NAME, xattr_virt, size, 0); mutex_unlock(&lower_inode->i_mutex); if (rc) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 8c6ad17285fd..52ac50ce1636 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1763,10 +1763,10 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, return fuse_update_attributes(inode, stat, NULL, NULL); } -static int fuse_setxattr(struct dentry *entry, const char *name, - const void *value, size_t size, int flags) +static int fuse_setxattr(struct dentry *unused, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) { - struct inode *inode = d_inode(entry); struct fuse_conn *fc = get_fuse_conn(inode); FUSE_ARGS(args); struct fuse_setxattr_in inarg; diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index eefef81ae3ba..3e7eb1fa83ac 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -1991,10 +1991,10 @@ static int gfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, return 0; } -static int gfs2_setxattr(struct dentry *dentry, const char *name, - const void *data, size_t size, int flags) +static int gfs2_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *data, + size_t size, int flags) { - struct inode *inode = d_inode(dentry); struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_holder gh; int ret; @@ -2004,7 +2004,8 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name, if (ret == 0) { ret = gfs2_rs_alloc(ip); if (ret == 0) - ret = generic_setxattr(dentry, name, data, size, flags); + ret = generic_setxattr(dentry, inode, name, data, size, + flags); gfs2_glock_dq(&gh); } gfs2_holder_uninit(&gh); diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c index 064f92f17efc..d9a86919fdf6 100644 --- a/fs/hfs/attr.c +++ b/fs/hfs/attr.c @@ -13,10 +13,10 @@ #include "hfs_fs.h" #include "btree.h" -int hfs_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +int hfs_setxattr(struct dentry *unused, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) { - struct inode *inode = d_inode(dentry); struct hfs_find_data fd; hfs_cat_rec rec; struct hfs_cat_file *file; diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index 79daa097929a..cacf761a782c 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -211,7 +211,7 @@ extern void hfs_evict_inode(struct inode *); extern void hfs_delete_inode(struct inode *); /* attr.c */ -extern int hfs_setxattr(struct dentry *dentry, const char *name, +extern int hfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags); extern ssize_t hfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h index e69e14f3777b..01c47b165313 100644 --- a/fs/jfs/jfs_xattr.h +++ b/fs/jfs/jfs_xattr.h @@ -54,8 +54,8 @@ struct jfs_ea_list { extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *, size_t, int); -extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t, - int); +extern int jfs_setxattr(struct dentry *, struct inode *, const char *, + const void *, size_t, int); extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t); extern ssize_t jfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t); extern ssize_t jfs_listxattr(struct dentry *, char *, size_t); diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 77e6c1a5377b..edfba219be94 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c @@ -848,10 +848,9 @@ int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name, return rc; } -int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, - size_t value_len, int flags) +int jfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, + const void *value, size_t value_len, int flags) { - struct inode *inode = d_inode(dentry); struct jfs_inode_info *ji = JFS_IP(inode); int rc; tid_t tid; @@ -862,7 +861,8 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) - return generic_setxattr(dentry, name, value, value_len, flags); + return generic_setxattr(dentry, inode, name, value, value_len, + flags); if ((rc = can_set_xattr(inode, name, value, value_len))) return rc; @@ -874,7 +874,7 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, tid = txBegin(inode->i_sb, 0); mutex_lock(&ji->commit_mutex); - rc = __jfs_setxattr(tid, d_inode(dentry), name, value, value_len, + rc = __jfs_setxattr(tid, inode, name, value, value_len, flags); if (!rc) rc = txCommit(tid, 1, &inode, 0); diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 4c643c128c22..664d06339bc9 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -157,10 +157,11 @@ static int kernfs_node_setsecdata(struct kernfs_node *kn, void **secdata, return 0; } -int kernfs_iop_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +int kernfs_iop_setxattr(struct dentry *unused, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) { - struct kernfs_node *kn = dentry->d_fsdata; + struct kernfs_node *kn = inode->i_private; struct kernfs_iattrs *attrs; void *secdata; int error; @@ -172,11 +173,11 @@ int kernfs_iop_setxattr(struct dentry *dentry, const char *name, if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) { const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; - error = security_inode_setsecurity(d_inode(dentry), suffix, + error = security_inode_setsecurity(inode, suffix, value, size, flags); if (error) return error; - error = security_inode_getsecctx(d_inode(dentry), + error = security_inode_getsecctx(inode, &secdata, &secdata_len); if (error) return error; diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h index 45c9192c276e..37159235ac10 100644 --- a/fs/kernfs/kernfs-internal.h +++ b/fs/kernfs/kernfs-internal.h @@ -81,7 +81,8 @@ int kernfs_iop_permission(struct inode *inode, int mask); int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr); int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); -int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value, +int kernfs_iop_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, int flags); int kernfs_iop_removexattr(struct dentry *dentry, const char *name); ssize_t kernfs_iop_getxattr(struct dentry *dentry, struct inode *inode, diff --git a/fs/libfs.c b/fs/libfs.c index 18804a8ea5ca..59ac04b542a3 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1125,8 +1125,9 @@ static int empty_dir_setattr(struct dentry *dentry, struct iattr *attr) return -EPERM; } -static int empty_dir_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +static int empty_dir_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) { return -EOPNOTSUPP; } diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index e3a0dafdf9ac..4809a9c940db 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -224,8 +224,9 @@ bool ovl_is_private_xattr(const char *name) return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0; } -int ovl_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +int ovl_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, + size_t size, int flags) { int err; struct dentry *upperdentry; diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 837b7dc80cc5..d03618d20955 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -171,8 +171,9 @@ void ovl_workdir_cleanup(struct inode *dir, struct vfsmount *mnt, /* inode.c */ int ovl_setattr(struct dentry *dentry, struct iattr *attr); int ovl_permission(struct inode *inode, int mask); -int ovl_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags); +int ovl_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, + size_t size, int flags); ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *value, size_t size); ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index f2115158214f..bf2fc8622b29 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -1756,7 +1756,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat); /* xattr.c */ -int ubifs_setxattr(struct dentry *dentry, const char *name, +int ubifs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags); ssize_t ubifs_getxattr(struct dentry *dentry, struct inode *host, const char *name, void *buf, size_t size); diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index c2f0e5735a40..55af1868751c 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -365,13 +365,13 @@ out_free: return err; } -int ubifs_setxattr(struct dentry *dentry, const char *name, +int ubifs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", - name, d_inode(dentry)->i_ino, dentry, size); + name, inode->i_ino, dentry, size); - return setxattr(d_inode(dentry), name, value, size, flags); + return setxattr(inode, name, value, size, flags); } ssize_t ubifs_getxattr(struct dentry *dentry, struct inode *host, diff --git a/fs/xattr.c b/fs/xattr.c index 87b67a010b6c..916b04dc44c2 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -100,7 +100,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, if (issec) inode->i_flags &= ~S_NOSEC; if (inode->i_op->setxattr) { - error = inode->i_op->setxattr(dentry, name, value, size, flags); + error = inode->i_op->setxattr(dentry, inode, name, value, size, flags); if (!error) { fsnotify_xattr(dentry); security_inode_post_setxattr(dentry, name, value, @@ -760,7 +760,8 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) * Find the handler for the prefix and dispatch its set() operation. */ int -generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) +generic_setxattr(struct dentry *dentry, struct inode *inode, const char *name, + const void *value, size_t size, int flags) { const struct xattr_handler *handler; @@ -769,8 +770,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); if (!handler) return -EOPNOTSUPP; - return handler->set(handler, dentry, d_inode(dentry), name, value, - size, flags); + return handler->set(handler, dentry, inode, name, value, size, flags); } /* |