aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-27 20:14:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-27 20:14:05 -0400
commitd102a56edba7a3f236454716fa09920e66772044 (patch)
treebfed5508d09028bbf180507b21b8ab25c6980eac /fs
parent0121a32201dcc72933fb6019c41661e2f8a02fc5 (diff)
parent3767e255b390d72f9a33c08d9e86c5f21f25860f (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fixes from Al Viro: "Followups to the parallel lookup work: - update docs - restore killability of the places that used to take ->i_mutex killably now that we have down_write_killable() merged - Additionally, it turns out that I missed a prerequisite for security_d_instantiate() stuff - ->getxattr() wasn't the only thing that could be called before dentry is attached to inode; with smack we needed the same treatment applied to ->setxattr() as well" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: switch ->setxattr() to passing dentry and inode separately switch xattr_handler->set() to passing dentry and inode separately restore killability of old mutex_lock_killable(&inode->i_mutex) users add down_write_killable_nested() update D/f/directory-locking
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/acl.c6
-rw-r--r--fs/9p/xattr.c5
-rw-r--r--fs/bad_inode.c4
-rw-r--r--fs/btrfs/ioctl.c18
-rw-r--r--fs/btrfs/xattr.c12
-rw-r--r--fs/ceph/xattr.c7
-rw-r--r--fs/cifs/xattr.c9
-rw-r--r--fs/ecryptfs/crypto.c9
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h4
-rw-r--r--fs/ecryptfs/inode.c7
-rw-r--r--fs/ecryptfs/mmap.c3
-rw-r--r--fs/ext2/xattr_security.c7
-rw-r--r--fs/ext2/xattr_trusted.c7
-rw-r--r--fs/ext2/xattr_user.c9
-rw-r--r--fs/ext4/xattr_security.c7
-rw-r--r--fs/ext4/xattr_trusted.c7
-rw-r--r--fs/ext4/xattr_user.c9
-rw-r--r--fs/f2fs/xattr.c12
-rw-r--r--fs/fuse/dir.c6
-rw-r--r--fs/gfs2/xattr.c6
-rw-r--r--fs/hfs/attr.c6
-rw-r--r--fs/hfs/hfs_fs.h2
-rw-r--r--fs/hfsplus/xattr.c12
-rw-r--r--fs/hfsplus/xattr.h2
-rw-r--r--fs/hfsplus/xattr_security.c7
-rw-r--r--fs/hfsplus/xattr_trusted.c7
-rw-r--r--fs/hfsplus/xattr_user.c7
-rw-r--r--fs/jffs2/security.c7
-rw-r--r--fs/jffs2/xattr_trusted.c7
-rw-r--r--fs/jffs2/xattr_user.c7
-rw-r--r--fs/jfs/xattr.c14
-rw-r--r--fs/kernfs/inode.c11
-rw-r--r--fs/kernfs/kernfs-internal.h3
-rw-r--r--fs/libfs.c5
-rw-r--r--fs/nfs/nfs4proc.c19
-rw-r--r--fs/ocfs2/xattr.c23
-rw-r--r--fs/orangefs/xattr.c10
-rw-r--r--fs/overlayfs/inode.c5
-rw-r--r--fs/overlayfs/overlayfs.h5
-rw-r--r--fs/overlayfs/readdir.c4
-rw-r--r--fs/posix_acl.c6
-rw-r--r--fs/readdir.c12
-rw-r--r--fs/reiserfs/xattr_security.c9
-rw-r--r--fs/reiserfs/xattr_trusted.c9
-rw-r--r--fs/reiserfs/xattr_user.c9
-rw-r--r--fs/ubifs/xattr.c7
-rw-r--r--fs/xattr.c10
-rw-r--r--fs/xfs/xfs_xattr.c9
48 files changed, 205 insertions, 183 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index eb3589edf485..0576eaeb60b9 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -239,13 +239,13 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
239} 239}
240 240
241static int v9fs_xattr_set_acl(const struct xattr_handler *handler, 241static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
242 struct dentry *dentry, const char *name, 242 struct dentry *dentry, struct inode *inode,
243 const void *value, size_t size, int flags) 243 const char *name, const void *value,
244 size_t size, int flags)
244{ 245{
245 int retval; 246 int retval;
246 struct posix_acl *acl; 247 struct posix_acl *acl;
247 struct v9fs_session_info *v9ses; 248 struct v9fs_session_info *v9ses;
248 struct inode *inode = d_inode(dentry);
249 249
250 v9ses = v9fs_dentry2v9ses(dentry); 250 v9ses = v9fs_dentry2v9ses(dentry);
251 /* 251 /*
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 18c62bae9591..a6bd349bab23 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -147,8 +147,9 @@ static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
147} 147}
148 148
149static int v9fs_xattr_handler_set(const struct xattr_handler *handler, 149static int v9fs_xattr_handler_set(const struct xattr_handler *handler,
150 struct dentry *dentry, const char *name, 150 struct dentry *dentry, struct inode *inode,
151 const void *value, size_t size, int flags) 151 const char *name, const void *value,
152 size_t size, int flags)
152{ 153{
153 const char *full_name = xattr_full_name(handler, name); 154 const char *full_name = xattr_full_name(handler, name);
154 155
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 72e35b721608..3ba385eaa26e 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)
100 return -EIO; 100 return -EIO;
101} 101}
102 102
103static int bad_inode_setxattr(struct dentry *dentry, const char *name, 103static int bad_inode_setxattr(struct dentry *dentry, struct inode *inode,
104 const void *value, size_t size, int flags) 104 const char *name, const void *value, size_t size, int flags)
105{ 105{
106 return -EIO; 106 return -EIO;
107} 107}
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 001c111e5627..05173563e4a6 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -846,11 +846,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
846 struct dentry *dentry; 846 struct dentry *dentry;
847 int error; 847 int error;
848 848
849 inode_lock_nested(dir, I_MUTEX_PARENT); 849 error = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
850 // XXX: should've been 850 if (error == -EINTR)
851 // mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); 851 return error;
852 // if (error == -EINTR)
853 // return error;
854 852
855 dentry = lookup_one_len(name, parent->dentry, namelen); 853 dentry = lookup_one_len(name, parent->dentry, namelen);
856 error = PTR_ERR(dentry); 854 error = PTR_ERR(dentry);
@@ -2377,11 +2375,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2377 goto out; 2375 goto out;
2378 2376
2379 2377
2380 inode_lock_nested(dir, I_MUTEX_PARENT); 2378 err = down_write_killable_nested(&dir->i_rwsem, I_MUTEX_PARENT);
2381 // XXX: should've been 2379 if (err == -EINTR)
2382 // err = mutex_lock_killable_nested(&dir->i_mutex, I_MUTEX_PARENT); 2380 goto out_drop_write;
2383 // if (err == -EINTR)
2384 // goto out_drop_write;
2385 dentry = lookup_one_len(vol_args->name, parent, namelen); 2381 dentry = lookup_one_len(vol_args->name, parent, namelen);
2386 if (IS_ERR(dentry)) { 2382 if (IS_ERR(dentry)) {
2387 err = PTR_ERR(dentry); 2383 err = PTR_ERR(dentry);
@@ -2571,7 +2567,7 @@ out_dput:
2571 dput(dentry); 2567 dput(dentry);
2572out_unlock_dir: 2568out_unlock_dir:
2573 inode_unlock(dir); 2569 inode_unlock(dir);
2574//out_drop_write: 2570out_drop_write:
2575 mnt_drop_write_file(file); 2571 mnt_drop_write_file(file);
2576out: 2572out:
2577 kfree(vol_args); 2573 kfree(vol_args);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 3bfb252206c7..d1a177a3dbe8 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -380,23 +380,21 @@ static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
380} 380}
381 381
382static int btrfs_xattr_handler_set(const struct xattr_handler *handler, 382static int btrfs_xattr_handler_set(const struct xattr_handler *handler,
383 struct dentry *dentry, const char *name, 383 struct dentry *unused, struct inode *inode,
384 const void *buffer, size_t size, 384 const char *name, const void *buffer,
385 int flags) 385 size_t size, int flags)
386{ 386{
387 struct inode *inode = d_inode(dentry);
388
389 name = xattr_full_name(handler, name); 387 name = xattr_full_name(handler, name);
390 return __btrfs_setxattr(NULL, inode, name, buffer, size, flags); 388 return __btrfs_setxattr(NULL, inode, name, buffer, size, flags);
391} 389}
392 390
393static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler, 391static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
394 struct dentry *dentry, 392 struct dentry *unused, struct inode *inode,
395 const char *name, const void *value, 393 const char *name, const void *value,
396 size_t size, int flags) 394 size_t size, int flags)
397{ 395{
398 name = xattr_full_name(handler, name); 396 name = xattr_full_name(handler, name);
399 return btrfs_set_prop(d_inode(dentry), name, value, size, flags); 397 return btrfs_set_prop(inode, name, value, size, flags);
400} 398}
401 399
402static const struct xattr_handler btrfs_security_xattr_handler = { 400static const struct xattr_handler btrfs_security_xattr_handler = {
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index dacc1bd85629..4870b29df224 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -1056,12 +1056,13 @@ static int ceph_get_xattr_handler(const struct xattr_handler *handler,
1056} 1056}
1057 1057
1058static int ceph_set_xattr_handler(const struct xattr_handler *handler, 1058static int ceph_set_xattr_handler(const struct xattr_handler *handler,
1059 struct dentry *dentry, const char *name, 1059 struct dentry *unused, struct inode *inode,
1060 const void *value, size_t size, int flags) 1060 const char *name, const void *value,
1061 size_t size, int flags)
1061{ 1062{
1062 if (!ceph_is_valid_xattr(name)) 1063 if (!ceph_is_valid_xattr(name))
1063 return -EOPNOTSUPP; 1064 return -EOPNOTSUPP;
1064 return __ceph_setxattr(d_inode(dentry), name, value, size, flags); 1065 return __ceph_setxattr(inode, name, value, size, flags);
1065} 1066}
1066 1067
1067const struct xattr_handler ceph_other_xattr_handler = { 1068const struct xattr_handler ceph_other_xattr_handler = {
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index c8b77aa24a1d..5e23f64c0804 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -39,8 +39,9 @@
39enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT }; 39enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT };
40 40
41static int cifs_xattr_set(const struct xattr_handler *handler, 41static int cifs_xattr_set(const struct xattr_handler *handler,
42 struct dentry *dentry, const char *name, 42 struct dentry *dentry, struct inode *inode,
43 const void *value, size_t size, int flags) 43 const char *name, const void *value,
44 size_t size, int flags)
44{ 45{
45 int rc = -EOPNOTSUPP; 46 int rc = -EOPNOTSUPP;
46 unsigned int xid; 47 unsigned int xid;
@@ -99,12 +100,12 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
99 if (value && 100 if (value &&
100 pTcon->ses->server->ops->set_acl) 101 pTcon->ses->server->ops->set_acl)
101 rc = pTcon->ses->server->ops->set_acl(pacl, 102 rc = pTcon->ses->server->ops->set_acl(pacl,
102 size, d_inode(dentry), 103 size, inode,
103 full_path, CIFS_ACL_DACL); 104 full_path, CIFS_ACL_DACL);
104 else 105 else
105 rc = -EOPNOTSUPP; 106 rc = -EOPNOTSUPP;
106 if (rc == 0) /* force revalidate of the inode */ 107 if (rc == 0) /* force revalidate of the inode */
107 CIFS_I(d_inode(dentry))->time = 0; 108 CIFS_I(inode)->time = 0;
108 kfree(pacl); 109 kfree(pacl);
109 } 110 }
110#endif /* CONFIG_CIFS_ACL */ 111#endif /* CONFIG_CIFS_ACL */
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ebd40f46ed4c..0d8eb3455b34 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1141,12 +1141,13 @@ ecryptfs_write_metadata_to_contents(struct inode *ecryptfs_inode,
1141 1141
1142static int 1142static int
1143ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry, 1143ecryptfs_write_metadata_to_xattr(struct dentry *ecryptfs_dentry,
1144 struct inode *ecryptfs_inode,
1144 char *page_virt, size_t size) 1145 char *page_virt, size_t size)
1145{ 1146{
1146 int rc; 1147 int rc;
1147 1148
1148 rc = ecryptfs_setxattr(ecryptfs_dentry, ECRYPTFS_XATTR_NAME, page_virt, 1149 rc = ecryptfs_setxattr(ecryptfs_dentry, ecryptfs_inode,
1149 size, 0); 1150 ECRYPTFS_XATTR_NAME, page_virt, size, 0);
1150 return rc; 1151 return rc;
1151} 1152}
1152 1153
@@ -1215,8 +1216,8 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry,
1215 goto out_free; 1216 goto out_free;
1216 } 1217 }
1217 if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) 1218 if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR)
1218 rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, virt, 1219 rc = ecryptfs_write_metadata_to_xattr(ecryptfs_dentry, ecryptfs_inode,
1219 size); 1220 virt, size);
1220 else 1221 else
1221 rc = ecryptfs_write_metadata_to_contents(ecryptfs_inode, virt, 1222 rc = ecryptfs_write_metadata_to_contents(ecryptfs_inode, virt,
1222 virt_len); 1223 virt_len);
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 3ec495db7e82..4ba1547bb9ad 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -609,8 +609,8 @@ ssize_t
609ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, 609ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode,
610 const char *name, void *value, size_t size); 610 const char *name, void *value, size_t size);
611int 611int
612ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, 612ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
613 size_t size, int flags); 613 const void *value, size_t size, int flags);
614int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode); 614int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode);
615#ifdef CONFIG_ECRYPT_FS_MESSAGING 615#ifdef CONFIG_ECRYPT_FS_MESSAGING
616int ecryptfs_process_response(struct ecryptfs_daemon *daemon, 616int ecryptfs_process_response(struct ecryptfs_daemon *daemon,
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 318b04689d76..9d153b6a1d72 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -1001,7 +1001,8 @@ static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1001} 1001}
1002 1002
1003int 1003int
1004ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, 1004ecryptfs_setxattr(struct dentry *dentry, struct inode *inode,
1005 const char *name, const void *value,
1005 size_t size, int flags) 1006 size_t size, int flags)
1006{ 1007{
1007 int rc = 0; 1008 int rc = 0;
@@ -1014,8 +1015,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
1014 } 1015 }
1015 1016
1016 rc = vfs_setxattr(lower_dentry, name, value, size, flags); 1017 rc = vfs_setxattr(lower_dentry, name, value, size, flags);
1017 if (!rc && d_really_is_positive(dentry)) 1018 if (!rc && inode)
1018 fsstack_copy_attr_all(d_inode(dentry), d_inode(lower_dentry)); 1019 fsstack_copy_attr_all(inode, d_inode(lower_dentry));
1019out: 1020out:
1020 return rc; 1021 return rc;
1021} 1022}
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 148d11b514fb..9c3437c8a5b1 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -442,7 +442,8 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
442 if (size < 0) 442 if (size < 0)
443 size = 8; 443 size = 8;
444 put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt); 444 put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt);
445 rc = lower_inode->i_op->setxattr(lower_dentry, ECRYPTFS_XATTR_NAME, 445 rc = lower_inode->i_op->setxattr(lower_dentry, lower_inode,
446 ECRYPTFS_XATTR_NAME,
446 xattr_virt, size, 0); 447 xattr_virt, size, 0);
447 inode_unlock(lower_inode); 448 inode_unlock(lower_inode);
448 if (rc) 449 if (rc)
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c
index 7fd3b867ce65..7b9e9c1842d5 100644
--- a/fs/ext2/xattr_security.c
+++ b/fs/ext2/xattr_security.c
@@ -18,10 +18,11 @@ ext2_xattr_security_get(const struct xattr_handler *handler,
18 18
19static int 19static int
20ext2_xattr_security_set(const struct xattr_handler *handler, 20ext2_xattr_security_set(const struct xattr_handler *handler,
21 struct dentry *dentry, const char *name, 21 struct dentry *unused, struct inode *inode,
22 const void *value, size_t size, int flags) 22 const char *name, const void *value,
23 size_t size, int flags)
23{ 24{
24 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, 25 return ext2_xattr_set(inode, EXT2_XATTR_INDEX_SECURITY, name,
25 value, size, flags); 26 value, size, flags);
26} 27}
27 28
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c
index 0f85705ff519..65049b71af13 100644
--- a/fs/ext2/xattr_trusted.c
+++ b/fs/ext2/xattr_trusted.c
@@ -25,10 +25,11 @@ ext2_xattr_trusted_get(const struct xattr_handler *handler,
25 25
26static int 26static int
27ext2_xattr_trusted_set(const struct xattr_handler *handler, 27ext2_xattr_trusted_set(const struct xattr_handler *handler,
28 struct dentry *dentry, const char *name, 28 struct dentry *unused, struct inode *inode,
29 const void *value, size_t size, int flags) 29 const char *name, const void *value,
30 size_t size, int flags)
30{ 31{
31 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, 32 return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
32 value, size, flags); 33 value, size, flags);
33} 34}
34 35
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index 1fafd27037cc..fb2f992ae763 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -29,13 +29,14 @@ ext2_xattr_user_get(const struct xattr_handler *handler,
29 29
30static int 30static int
31ext2_xattr_user_set(const struct xattr_handler *handler, 31ext2_xattr_user_set(const struct xattr_handler *handler,
32 struct dentry *dentry, const char *name, 32 struct dentry *unused, struct inode *inode,
33 const void *value, size_t size, int flags) 33 const char *name, const void *value,
34 size_t size, int flags)
34{ 35{
35 if (!test_opt(dentry->d_sb, XATTR_USER)) 36 if (!test_opt(inode->i_sb, XATTR_USER))
36 return -EOPNOTSUPP; 37 return -EOPNOTSUPP;
37 38
38 return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER, 39 return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER,
39 name, value, size, flags); 40 name, value, size, flags);
40} 41}
41 42
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index 123a7d010efe..a8921112030d 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -22,10 +22,11 @@ ext4_xattr_security_get(const struct xattr_handler *handler,
22 22
23static int 23static int
24ext4_xattr_security_set(const struct xattr_handler *handler, 24ext4_xattr_security_set(const struct xattr_handler *handler,
25 struct dentry *dentry, const char *name, 25 struct dentry *unused, struct inode *inode,
26 const void *value, size_t size, int flags) 26 const char *name, const void *value,
27 size_t size, int flags)
27{ 28{
28 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, 29 return ext4_xattr_set(inode, EXT4_XATTR_INDEX_SECURITY,
29 name, value, size, flags); 30 name, value, size, flags);
30} 31}
31 32
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index 60652fa24cbc..c7765c735714 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -29,10 +29,11 @@ ext4_xattr_trusted_get(const struct xattr_handler *handler,
29 29
30static int 30static int
31ext4_xattr_trusted_set(const struct xattr_handler *handler, 31ext4_xattr_trusted_set(const struct xattr_handler *handler,
32 struct dentry *dentry, const char *name, 32 struct dentry *unused, struct inode *inode,
33 const void *value, size_t size, int flags) 33 const char *name, const void *value,
34 size_t size, int flags)
34{ 35{
35 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, 36 return ext4_xattr_set(inode, EXT4_XATTR_INDEX_TRUSTED,
36 name, value, size, flags); 37 name, value, size, flags);
37} 38}
38 39
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index 17a446ffecd3..ca20e423034b 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -30,12 +30,13 @@ ext4_xattr_user_get(const struct xattr_handler *handler,
30 30
31static int 31static int
32ext4_xattr_user_set(const struct xattr_handler *handler, 32ext4_xattr_user_set(const struct xattr_handler *handler,
33 struct dentry *dentry, const char *name, 33 struct dentry *unused, struct inode *inode,
34 const void *value, size_t size, int flags) 34 const char *name, const void *value,
35 size_t size, int flags)
35{ 36{
36 if (!test_opt(dentry->d_sb, XATTR_USER)) 37 if (!test_opt(inode->i_sb, XATTR_USER))
37 return -EOPNOTSUPP; 38 return -EOPNOTSUPP;
38 return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, 39 return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER,
39 name, value, size, flags); 40 name, value, size, flags);
40} 41}
41 42
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 00ea56797258..e3decae3acfb 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -50,10 +50,11 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
50} 50}
51 51
52static int f2fs_xattr_generic_set(const struct xattr_handler *handler, 52static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
53 struct dentry *dentry, const char *name, const void *value, 53 struct dentry *unused, struct inode *inode,
54 const char *name, const void *value,
54 size_t size, int flags) 55 size_t size, int flags)
55{ 56{
56 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 57 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
57 58
58 switch (handler->flags) { 59 switch (handler->flags) {
59 case F2FS_XATTR_INDEX_USER: 60 case F2FS_XATTR_INDEX_USER:
@@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
69 default: 70 default:
70 return -EINVAL; 71 return -EINVAL;
71 } 72 }
72 return f2fs_setxattr(d_inode(dentry), handler->flags, name, 73 return f2fs_setxattr(inode, handler->flags, name,
73 value, size, NULL, flags); 74 value, size, NULL, flags);
74} 75}
75 76
@@ -95,11 +96,10 @@ static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
95} 96}
96 97
97static int f2fs_xattr_advise_set(const struct xattr_handler *handler, 98static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
98 struct dentry *dentry, const char *name, const void *value, 99 struct dentry *unused, struct inode *inode,
100 const char *name, const void *value,
99 size_t size, int flags) 101 size_t size, int flags)
100{ 102{
101 struct inode *inode = d_inode(dentry);
102
103 if (!inode_owner_or_capable(inode)) 103 if (!inode_owner_or_capable(inode))
104 return -EPERM; 104 return -EPERM;
105 if (value == NULL) 105 if (value == NULL)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index b9419058108f..ccd4971cc6c1 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1719,10 +1719,10 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1719 return fuse_update_attributes(inode, stat, NULL, NULL); 1719 return fuse_update_attributes(inode, stat, NULL, NULL);
1720} 1720}
1721 1721
1722static int fuse_setxattr(struct dentry *entry, const char *name, 1722static int fuse_setxattr(struct dentry *unused, struct inode *inode,
1723 const void *value, size_t size, int flags) 1723 const char *name, const void *value,
1724 size_t size, int flags)
1724{ 1725{
1725 struct inode *inode = d_inode(entry);
1726 struct fuse_conn *fc = get_fuse_conn(inode); 1726 struct fuse_conn *fc = get_fuse_conn(inode);
1727 FUSE_ARGS(args); 1727 FUSE_ARGS(args);
1728 struct fuse_setxattr_in inarg; 1728 struct fuse_setxattr_in inarg;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index f42ab53bd30d..3a2853504084 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -1251,10 +1251,10 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
1251} 1251}
1252 1252
1253static int gfs2_xattr_set(const struct xattr_handler *handler, 1253static int gfs2_xattr_set(const struct xattr_handler *handler,
1254 struct dentry *dentry, const char *name, 1254 struct dentry *unused, struct inode *inode,
1255 const void *value, size_t size, int flags) 1255 const char *name, const void *value,
1256 size_t size, int flags)
1256{ 1257{
1257 struct inode *inode = d_inode(dentry);
1258 struct gfs2_inode *ip = GFS2_I(inode); 1258 struct gfs2_inode *ip = GFS2_I(inode);
1259 struct gfs2_holder gh; 1259 struct gfs2_holder gh;
1260 int ret; 1260 int ret;
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 @@
13#include "hfs_fs.h" 13#include "hfs_fs.h"
14#include "btree.h" 14#include "btree.h"
15 15
16int hfs_setxattr(struct dentry *dentry, const char *name, 16int hfs_setxattr(struct dentry *unused, struct inode *inode,
17 const void *value, size_t size, int flags) 17 const char *name, const void *value,
18 size_t size, int flags)
18{ 19{
19 struct inode *inode = d_inode(dentry);
20 struct hfs_find_data fd; 20 struct hfs_find_data fd;
21 hfs_cat_rec rec; 21 hfs_cat_rec rec;
22 struct hfs_cat_file *file; 22 struct hfs_cat_file *file;
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index fa3eed86837c..ee2f385811c8 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -212,7 +212,7 @@ extern void hfs_evict_inode(struct inode *);
212extern void hfs_delete_inode(struct inode *); 212extern void hfs_delete_inode(struct inode *);
213 213
214/* attr.c */ 214/* attr.c */
215extern int hfs_setxattr(struct dentry *dentry, const char *name, 215extern int hfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
216 const void *value, size_t size, int flags); 216 const void *value, size_t size, int flags);
217extern ssize_t hfs_getxattr(struct dentry *dentry, struct inode *inode, 217extern ssize_t hfs_getxattr(struct dentry *dentry, struct inode *inode,
218 const char *name, void *value, size_t size); 218 const char *name, void *value, size_t size);
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index 4f118d282a7a..d37bb88dc746 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -424,7 +424,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len)
424 return len; 424 return len;
425} 425}
426 426
427int hfsplus_setxattr(struct dentry *dentry, const char *name, 427int hfsplus_setxattr(struct inode *inode, const char *name,
428 const void *value, size_t size, int flags, 428 const void *value, size_t size, int flags,
429 const char *prefix, size_t prefixlen) 429 const char *prefix, size_t prefixlen)
430{ 430{
@@ -437,8 +437,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
437 return -ENOMEM; 437 return -ENOMEM;
438 strcpy(xattr_name, prefix); 438 strcpy(xattr_name, prefix);
439 strcpy(xattr_name + prefixlen, name); 439 strcpy(xattr_name + prefixlen, name);
440 res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size, 440 res = __hfsplus_setxattr(inode, xattr_name, value, size, flags);
441 flags);
442 kfree(xattr_name); 441 kfree(xattr_name);
443 return res; 442 return res;
444} 443}
@@ -864,8 +863,9 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
864} 863}
865 864
866static int hfsplus_osx_setxattr(const struct xattr_handler *handler, 865static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
867 struct dentry *dentry, const char *name, 866 struct dentry *unused, struct inode *inode,
868 const void *buffer, size_t size, int flags) 867 const char *name, const void *buffer,
868 size_t size, int flags)
869{ 869{
870 /* 870 /*
871 * Don't allow setting properly prefixed attributes 871 * Don't allow setting properly prefixed attributes
@@ -880,7 +880,7 @@ static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
880 * creates), so we pass the name through unmodified (after 880 * creates), so we pass the name through unmodified (after
881 * ensuring it doesn't conflict with another namespace). 881 * ensuring it doesn't conflict with another namespace).
882 */ 882 */
883 return __hfsplus_setxattr(d_inode(dentry), name, buffer, size, flags); 883 return __hfsplus_setxattr(inode, name, buffer, size, flags);
884} 884}
885 885
886const struct xattr_handler hfsplus_xattr_osx_handler = { 886const struct xattr_handler hfsplus_xattr_osx_handler = {
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index d04ba6f58df2..68f6b539371f 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -21,7 +21,7 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[];
21int __hfsplus_setxattr(struct inode *inode, const char *name, 21int __hfsplus_setxattr(struct inode *inode, const char *name,
22 const void *value, size_t size, int flags); 22 const void *value, size_t size, int flags);
23 23
24int hfsplus_setxattr(struct dentry *dentry, const char *name, 24int hfsplus_setxattr(struct inode *inode, const char *name,
25 const void *value, size_t size, int flags, 25 const void *value, size_t size, int flags,
26 const char *prefix, size_t prefixlen); 26 const char *prefix, size_t prefixlen);
27 27
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c
index ae2ca8c2e335..37b3efa733ef 100644
--- a/fs/hfsplus/xattr_security.c
+++ b/fs/hfsplus/xattr_security.c
@@ -23,10 +23,11 @@ static int hfsplus_security_getxattr(const struct xattr_handler *handler,
23} 23}
24 24
25static int hfsplus_security_setxattr(const struct xattr_handler *handler, 25static int hfsplus_security_setxattr(const struct xattr_handler *handler,
26 struct dentry *dentry, const char *name, 26 struct dentry *unused, struct inode *inode,
27 const void *buffer, size_t size, int flags) 27 const char *name, const void *buffer,
28 size_t size, int flags)
28{ 29{
29 return hfsplus_setxattr(dentry, name, buffer, size, flags, 30 return hfsplus_setxattr(inode, name, buffer, size, flags,
30 XATTR_SECURITY_PREFIX, 31 XATTR_SECURITY_PREFIX,
31 XATTR_SECURITY_PREFIX_LEN); 32 XATTR_SECURITY_PREFIX_LEN);
32} 33}
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c
index eae2947060aa..94519d6c627d 100644
--- a/fs/hfsplus/xattr_trusted.c
+++ b/fs/hfsplus/xattr_trusted.c
@@ -21,10 +21,11 @@ static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
21} 21}
22 22
23static int hfsplus_trusted_setxattr(const struct xattr_handler *handler, 23static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
24 struct dentry *dentry, const char *name, 24 struct dentry *unused, struct inode *inode,
25 const void *buffer, size_t size, int flags) 25 const char *name, const void *buffer,
26 size_t size, int flags)
26{ 27{
27 return hfsplus_setxattr(dentry, name, buffer, size, flags, 28 return hfsplus_setxattr(inode, name, buffer, size, flags,
28 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); 29 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
29} 30}
30 31
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c
index 3c9eec3e4c7b..fae6c0ea0030 100644
--- a/fs/hfsplus/xattr_user.c
+++ b/fs/hfsplus/xattr_user.c
@@ -21,10 +21,11 @@ static int hfsplus_user_getxattr(const struct xattr_handler *handler,
21} 21}
22 22
23static int hfsplus_user_setxattr(const struct xattr_handler *handler, 23static int hfsplus_user_setxattr(const struct xattr_handler *handler,
24 struct dentry *dentry, const char *name, 24 struct dentry *unused, struct inode *inode,
25 const void *buffer, size_t size, int flags) 25 const char *name, const void *buffer,
26 size_t size, int flags)
26{ 27{
27 return hfsplus_setxattr(dentry, name, buffer, size, flags, 28 return hfsplus_setxattr(inode, name, buffer, size, flags,
28 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 29 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
29} 30}
30 31
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index 3ed9a4b49778..c2332e30f218 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -57,10 +57,11 @@ static int jffs2_security_getxattr(const struct xattr_handler *handler,
57} 57}
58 58
59static int jffs2_security_setxattr(const struct xattr_handler *handler, 59static int jffs2_security_setxattr(const struct xattr_handler *handler,
60 struct dentry *dentry, const char *name, 60 struct dentry *unused, struct inode *inode,
61 const void *buffer, size_t size, int flags) 61 const char *name, const void *buffer,
62 size_t size, int flags)
62{ 63{
63 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, 64 return do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY,
64 name, buffer, size, flags); 65 name, buffer, size, flags);
65} 66}
66 67
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index 4ebecff1d922..5d6030826c52 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -25,10 +25,11 @@ static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
25} 25}
26 26
27static int jffs2_trusted_setxattr(const struct xattr_handler *handler, 27static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
28 struct dentry *dentry, const char *name, 28 struct dentry *unused, struct inode *inode,
29 const void *buffer, size_t size, int flags) 29 const char *name, const void *buffer,
30 size_t size, int flags)
30{ 31{
31 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, 32 return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED,
32 name, buffer, size, flags); 33 name, buffer, size, flags);
33} 34}
34 35
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c
index bce249e1b277..9d027b4abcf9 100644
--- a/fs/jffs2/xattr_user.c
+++ b/fs/jffs2/xattr_user.c
@@ -25,10 +25,11 @@ static int jffs2_user_getxattr(const struct xattr_handler *handler,
25} 25}
26 26
27static int jffs2_user_setxattr(const struct xattr_handler *handler, 27static int jffs2_user_setxattr(const struct xattr_handler *handler,
28 struct dentry *dentry, const char *name, 28 struct dentry *unused, struct inode *inode,
29 const void *buffer, size_t size, int flags) 29 const char *name, const void *buffer,
30 size_t size, int flags)
30{ 31{
31 return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER, 32 return do_jffs2_setxattr(inode, JFFS2_XPREFIX_USER,
32 name, buffer, size, flags); 33 name, buffer, size, flags);
33} 34}
34 35
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index beb182b503b3..0bf3c33aedff 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -943,11 +943,10 @@ static int jfs_xattr_get(const struct xattr_handler *handler,
943} 943}
944 944
945static int jfs_xattr_set(const struct xattr_handler *handler, 945static int jfs_xattr_set(const struct xattr_handler *handler,
946 struct dentry *dentry, const char *name, 946 struct dentry *unused, struct inode *inode,
947 const void *value, size_t size, int flags) 947 const char *name, const void *value,
948 size_t size, int flags)
948{ 949{
949 struct inode *inode = d_inode(dentry);
950
951 name = xattr_full_name(handler, name); 950 name = xattr_full_name(handler, name);
952 return __jfs_xattr_set(inode, name, value, size, flags); 951 return __jfs_xattr_set(inode, name, value, size, flags);
953} 952}
@@ -962,11 +961,10 @@ static int jfs_xattr_get_os2(const struct xattr_handler *handler,
962} 961}
963 962
964static int jfs_xattr_set_os2(const struct xattr_handler *handler, 963static int jfs_xattr_set_os2(const struct xattr_handler *handler,
965 struct dentry *dentry, const char *name, 964 struct dentry *unused, struct inode *inode,
966 const void *value, size_t size, int flags) 965 const char *name, const void *value,
966 size_t size, int flags)
967{ 967{
968 struct inode *inode = d_inode(dentry);
969
970 if (is_known_namespace(name)) 968 if (is_known_namespace(name))
971 return -EOPNOTSUPP; 969 return -EOPNOTSUPP;
972 return __jfs_xattr_set(inode, name, value, size, flags); 970 return __jfs_xattr_set(inode, name, value, size, flags);
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 1719649d7ad7..63b925d5ba1e 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -160,10 +160,11 @@ static int kernfs_node_setsecdata(struct kernfs_node *kn, void **secdata,
160 return 0; 160 return 0;
161} 161}
162 162
163int kernfs_iop_setxattr(struct dentry *dentry, const char *name, 163int kernfs_iop_setxattr(struct dentry *unused, struct inode *inode,
164 const void *value, size_t size, int flags) 164 const char *name, const void *value,
165 size_t size, int flags)
165{ 166{
166 struct kernfs_node *kn = dentry->d_fsdata; 167 struct kernfs_node *kn = inode->i_private;
167 struct kernfs_iattrs *attrs; 168 struct kernfs_iattrs *attrs;
168 void *secdata; 169 void *secdata;
169 int error; 170 int error;
@@ -175,11 +176,11 @@ int kernfs_iop_setxattr(struct dentry *dentry, const char *name,
175 176
176 if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) { 177 if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN)) {
177 const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; 178 const char *suffix = name + XATTR_SECURITY_PREFIX_LEN;
178 error = security_inode_setsecurity(d_inode(dentry), suffix, 179 error = security_inode_setsecurity(inode, suffix,
179 value, size, flags); 180 value, size, flags);
180 if (error) 181 if (error)
181 return error; 182 return error;
182 error = security_inode_getsecctx(d_inode(dentry), 183 error = security_inode_getsecctx(inode,
183 &secdata, &secdata_len); 184 &secdata, &secdata_len);
184 if (error) 185 if (error)
185 return error; 186 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);
81int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr); 81int kernfs_iop_setattr(struct dentry *dentry, struct iattr *iattr);
82int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry, 82int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
83 struct kstat *stat); 83 struct kstat *stat);
84int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value, 84int kernfs_iop_setxattr(struct dentry *dentry, struct inode *inode,
85 const char *name, const void *value,
85 size_t size, int flags); 86 size_t size, int flags);
86int kernfs_iop_removexattr(struct dentry *dentry, const char *name); 87int kernfs_iop_removexattr(struct dentry *dentry, const char *name);
87ssize_t kernfs_iop_getxattr(struct dentry *dentry, struct inode *inode, 88ssize_t kernfs_iop_getxattr(struct dentry *dentry, struct inode *inode,
diff --git a/fs/libfs.c b/fs/libfs.c
index 8765ff1adc07..3db2721144c2 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1118,8 +1118,9 @@ static int empty_dir_setattr(struct dentry *dentry, struct iattr *attr)
1118 return -EPERM; 1118 return -EPERM;
1119} 1119}
1120 1120
1121static int empty_dir_setxattr(struct dentry *dentry, const char *name, 1121static int empty_dir_setxattr(struct dentry *dentry, struct inode *inode,
1122 const void *value, size_t size, int flags) 1122 const char *name, const void *value,
1123 size_t size, int flags)
1123{ 1124{
1124 return -EOPNOTSUPP; 1125 return -EOPNOTSUPP;
1125} 1126}
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 223982eb38c9..de97567795a5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5015,12 +5015,11 @@ static int nfs4_do_set_security_label(struct inode *inode,
5015} 5015}
5016 5016
5017static int 5017static int
5018nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen) 5018nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen)
5019{ 5019{
5020 struct nfs4_label ilabel, *olabel = NULL; 5020 struct nfs4_label ilabel, *olabel = NULL;
5021 struct nfs_fattr fattr; 5021 struct nfs_fattr fattr;
5022 struct rpc_cred *cred; 5022 struct rpc_cred *cred;
5023 struct inode *inode = d_inode(dentry);
5024 int status; 5023 int status;
5025 5024
5026 if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) 5025 if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL))
@@ -6281,11 +6280,11 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
6281#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" 6280#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
6282 6281
6283static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler, 6282static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
6284 struct dentry *dentry, const char *key, 6283 struct dentry *unused, struct inode *inode,
6285 const void *buf, size_t buflen, 6284 const char *key, const void *buf,
6286 int flags) 6285 size_t buflen, int flags)
6287{ 6286{
6288 return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); 6287 return nfs4_proc_set_acl(inode, buf, buflen);
6289} 6288}
6290 6289
6291static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler, 6290static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
@@ -6303,12 +6302,12 @@ static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)
6303#ifdef CONFIG_NFS_V4_SECURITY_LABEL 6302#ifdef CONFIG_NFS_V4_SECURITY_LABEL
6304 6303
6305static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler, 6304static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
6306 struct dentry *dentry, const char *key, 6305 struct dentry *unused, struct inode *inode,
6307 const void *buf, size_t buflen, 6306 const char *key, const void *buf,
6308 int flags) 6307 size_t buflen, int flags)
6309{ 6308{
6310 if (security_ismaclabel(key)) 6309 if (security_ismaclabel(key))
6311 return nfs4_set_security_label(dentry, buf, buflen); 6310 return nfs4_set_security_label(inode, buf, buflen);
6312 6311
6313 return -EOPNOTSUPP; 6312 return -EOPNOTSUPP;
6314} 6313}
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index ad16995c9e7a..d2053853951e 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7254,10 +7254,11 @@ static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
7254} 7254}
7255 7255
7256static int ocfs2_xattr_security_set(const struct xattr_handler *handler, 7256static int ocfs2_xattr_security_set(const struct xattr_handler *handler,
7257 struct dentry *dentry, const char *name, 7257 struct dentry *unused, struct inode *inode,
7258 const void *value, size_t size, int flags) 7258 const char *name, const void *value,
7259 size_t size, int flags)
7259{ 7260{
7260 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, 7261 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
7261 name, value, size, flags); 7262 name, value, size, flags);
7262} 7263}
7263 7264
@@ -7325,10 +7326,11 @@ static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
7325} 7326}
7326 7327
7327static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler, 7328static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler,
7328 struct dentry *dentry, const char *name, 7329 struct dentry *unused, struct inode *inode,
7329 const void *value, size_t size, int flags) 7330 const char *name, const void *value,
7331 size_t size, int flags)
7330{ 7332{
7331 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, 7333 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_TRUSTED,
7332 name, value, size, flags); 7334 name, value, size, flags);
7333} 7335}
7334 7336
@@ -7354,15 +7356,16 @@ static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
7354} 7356}
7355 7357
7356static int ocfs2_xattr_user_set(const struct xattr_handler *handler, 7358static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
7357 struct dentry *dentry, const char *name, 7359 struct dentry *unused, struct inode *inode,
7358 const void *value, size_t size, int flags) 7360 const char *name, const void *value,
7361 size_t size, int flags)
7359{ 7362{
7360 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7363 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
7361 7364
7362 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7365 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7363 return -EOPNOTSUPP; 7366 return -EOPNOTSUPP;
7364 7367
7365 return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER, 7368 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_USER,
7366 name, value, size, flags); 7369 name, value, size, flags);
7367} 7370}
7368 7371
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c
index 99c19545752c..5893ddde0e4b 100644
--- a/fs/orangefs/xattr.c
+++ b/fs/orangefs/xattr.c
@@ -448,13 +448,14 @@ out_unlock:
448} 448}
449 449
450static int orangefs_xattr_set_default(const struct xattr_handler *handler, 450static int orangefs_xattr_set_default(const struct xattr_handler *handler,
451 struct dentry *dentry, 451 struct dentry *unused,
452 struct inode *inode,
452 const char *name, 453 const char *name,
453 const void *buffer, 454 const void *buffer,
454 size_t size, 455 size_t size,
455 int flags) 456 int flags)
456{ 457{
457 return orangefs_inode_setxattr(dentry->d_inode, 458 return orangefs_inode_setxattr(inode,
458 ORANGEFS_XATTR_NAME_DEFAULT_PREFIX, 459 ORANGEFS_XATTR_NAME_DEFAULT_PREFIX,
459 name, 460 name,
460 buffer, 461 buffer,
@@ -478,13 +479,14 @@ static int orangefs_xattr_get_default(const struct xattr_handler *handler,
478} 479}
479 480
480static int orangefs_xattr_set_trusted(const struct xattr_handler *handler, 481static int orangefs_xattr_set_trusted(const struct xattr_handler *handler,
481 struct dentry *dentry, 482 struct dentry *unused,
483 struct inode *inode,
482 const char *name, 484 const char *name,
483 const void *buffer, 485 const void *buffer,
484 size_t size, 486 size_t size,
485 int flags) 487 int flags)
486{ 488{
487 return orangefs_inode_setxattr(dentry->d_inode, 489 return orangefs_inode_setxattr(inode,
488 ORANGEFS_XATTR_NAME_TRUSTED_PREFIX, 490 ORANGEFS_XATTR_NAME_TRUSTED_PREFIX,
489 name, 491 name,
490 buffer, 492 buffer,
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index c7b31a03dc9c..0ed7c4012437 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -210,8 +210,9 @@ static bool ovl_is_private_xattr(const char *name)
210 return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0; 210 return strncmp(name, OVL_XATTR_PRE_NAME, OVL_XATTR_PRE_LEN) == 0;
211} 211}
212 212
213int ovl_setxattr(struct dentry *dentry, const char *name, 213int ovl_setxattr(struct dentry *dentry, struct inode *inode,
214 const void *value, size_t size, int flags) 214 const char *name, const void *value,
215 size_t size, int flags)
215{ 216{
216 int err; 217 int err;
217 struct dentry *upperdentry; 218 struct dentry *upperdentry;
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 724f5fcb4e24..4bd9b5ba8f42 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -172,8 +172,9 @@ int ovl_check_d_type_supported(struct path *realpath);
172/* inode.c */ 172/* inode.c */
173int ovl_setattr(struct dentry *dentry, struct iattr *attr); 173int ovl_setattr(struct dentry *dentry, struct iattr *attr);
174int ovl_permission(struct inode *inode, int mask); 174int ovl_permission(struct inode *inode, int mask);
175int ovl_setxattr(struct dentry *dentry, const char *name, 175int ovl_setxattr(struct dentry *dentry, struct inode *inode,
176 const void *value, size_t size, int flags); 176 const char *name, const void *value,
177 size_t size, int flags);
177ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode, 178ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode,
178 const char *name, void *value, size_t size); 179 const char *name, void *value, size_t size);
179ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); 180ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index d11ae826bcbc..cf37fc76fc9f 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -210,9 +210,7 @@ static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd)
210 210
211 old_cred = ovl_override_creds(rdd->dentry->d_sb); 211 old_cred = ovl_override_creds(rdd->dentry->d_sb);
212 212
213 inode_lock(dir->d_inode); 213 err = down_write_killable(&dir->d_inode->i_rwsem);
214 err = 0;
215 // XXX: err = mutex_lock_killable(&dir->d_inode->i_mutex);
216 if (!err) { 214 if (!err) {
217 while (rdd->first_maybe_whiteout) { 215 while (rdd->first_maybe_whiteout) {
218 p = rdd->first_maybe_whiteout; 216 p = rdd->first_maybe_whiteout;
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 2c60f17e7d92..8a4a266beff3 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -822,10 +822,10 @@ posix_acl_xattr_get(const struct xattr_handler *handler,
822 822
823static int 823static int
824posix_acl_xattr_set(const struct xattr_handler *handler, 824posix_acl_xattr_set(const struct xattr_handler *handler,
825 struct dentry *dentry, const char *name, 825 struct dentry *unused, struct inode *inode,
826 const void *value, size_t size, int flags) 826 const char *name, const void *value,
827 size_t size, int flags)
827{ 828{
828 struct inode *inode = d_backing_inode(dentry);
829 struct posix_acl *acl = NULL; 829 struct posix_acl *acl = NULL;
830 int ret; 830 int ret;
831 831
diff --git a/fs/readdir.c b/fs/readdir.c
index 68ef06efe6bc..9d0212c374d6 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -35,13 +35,13 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
35 if (res) 35 if (res)
36 goto out; 36 goto out;
37 37
38 if (shared) 38 if (shared) {
39 inode_lock_shared(inode); 39 inode_lock_shared(inode);
40 else 40 } else {
41 inode_lock(inode); 41 res = down_write_killable(&inode->i_rwsem);
42 // res = mutex_lock_killable(&inode->i_mutex); 42 if (res)
43 // if (res) 43 goto out;
44 // goto out; 44 }
45 45
46 res = -ENOENT; 46 res = -ENOENT;
47 if (!IS_DEADDIR(inode)) { 47 if (!IS_DEADDIR(inode)) {
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index 86aeb9dd805a..e4cbb7719906 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -20,13 +20,14 @@ security_get(const struct xattr_handler *handler, struct dentry *unused,
20} 20}
21 21
22static int 22static int
23security_set(const struct xattr_handler *handler, struct dentry *dentry, 23security_set(const struct xattr_handler *handler, struct dentry *unused,
24 const char *name, const void *buffer, size_t size, int flags) 24 struct inode *inode, const char *name, const void *buffer,
25 size_t size, int flags)
25{ 26{
26 if (IS_PRIVATE(d_inode(dentry))) 27 if (IS_PRIVATE(inode))
27 return -EPERM; 28 return -EPERM;
28 29
29 return reiserfs_xattr_set(d_inode(dentry), 30 return reiserfs_xattr_set(inode,
30 xattr_full_name(handler, name), 31 xattr_full_name(handler, name),
31 buffer, size, flags); 32 buffer, size, flags);
32} 33}
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
index 31837f031f59..f15a5f9e84ce 100644
--- a/fs/reiserfs/xattr_trusted.c
+++ b/fs/reiserfs/xattr_trusted.c
@@ -19,13 +19,14 @@ trusted_get(const struct xattr_handler *handler, struct dentry *unused,
19} 19}
20 20
21static int 21static int
22trusted_set(const struct xattr_handler *handler, struct dentry *dentry, 22trusted_set(const struct xattr_handler *handler, struct dentry *unused,
23 const char *name, const void *buffer, size_t size, int flags) 23 struct inode *inode, const char *name, const void *buffer,
24 size_t size, int flags)
24{ 25{
25 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) 26 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
26 return -EPERM; 27 return -EPERM;
27 28
28 return reiserfs_xattr_set(d_inode(dentry), 29 return reiserfs_xattr_set(inode,
29 xattr_full_name(handler, name), 30 xattr_full_name(handler, name),
30 buffer, size, flags); 31 buffer, size, flags);
31} 32}
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index f7c39731684b..dc59df43b2db 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -17,12 +17,13 @@ user_get(const struct xattr_handler *handler, struct dentry *unused,
17} 17}
18 18
19static int 19static int
20user_set(const struct xattr_handler *handler, struct dentry *dentry, 20user_set(const struct xattr_handler *handler, struct dentry *unused,
21 const char *name, const void *buffer, size_t size, int flags) 21 struct inode *inode, const char *name, const void *buffer,
22 size_t size, int flags)
22{ 23{
23 if (!reiserfs_xattrs_user(dentry->d_sb)) 24 if (!reiserfs_xattrs_user(inode->i_sb))
24 return -EOPNOTSUPP; 25 return -EOPNOTSUPP;
25 return reiserfs_xattr_set(d_inode(dentry), 26 return reiserfs_xattr_set(inode,
26 xattr_full_name(handler, name), 27 xattr_full_name(handler, name),
27 buffer, size, flags); 28 buffer, size, flags);
28} 29}
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index 6c277eb6aef9..b5fc27969e9d 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -579,11 +579,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler,
579} 579}
580 580
581static int ubifs_xattr_set(const struct xattr_handler *handler, 581static int ubifs_xattr_set(const struct xattr_handler *handler,
582 struct dentry *dentry, const char *name, 582 struct dentry *dentry, struct inode *inode,
583 const void *value, size_t size, int flags) 583 const char *name, const void *value,
584 size_t size, int flags)
584{ 585{
585 struct inode *inode = d_inode(dentry);
586
587 dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", 586 dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd",
588 name, inode->i_ino, dentry, size); 587 name, inode->i_ino, dentry, size);
589 588
diff --git a/fs/xattr.c b/fs/xattr.c
index fc81e771488a..4beafc43daa5 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -100,7 +100,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
100 if (issec) 100 if (issec)
101 inode->i_flags &= ~S_NOSEC; 101 inode->i_flags &= ~S_NOSEC;
102 if (inode->i_op->setxattr) { 102 if (inode->i_op->setxattr) {
103 error = inode->i_op->setxattr(dentry, name, value, size, flags); 103 error = inode->i_op->setxattr(dentry, inode, name, value, size, flags);
104 if (!error) { 104 if (!error) {
105 fsnotify_xattr(dentry); 105 fsnotify_xattr(dentry);
106 security_inode_post_setxattr(dentry, name, value, 106 security_inode_post_setxattr(dentry, name, value,
@@ -745,7 +745,8 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
745 * Find the handler for the prefix and dispatch its set() operation. 745 * Find the handler for the prefix and dispatch its set() operation.
746 */ 746 */
747int 747int
748generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) 748generic_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
749 const void *value, size_t size, int flags)
749{ 750{
750 const struct xattr_handler *handler; 751 const struct xattr_handler *handler;
751 752
@@ -754,7 +755,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
754 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 755 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
755 if (IS_ERR(handler)) 756 if (IS_ERR(handler))
756 return PTR_ERR(handler); 757 return PTR_ERR(handler);
757 return handler->set(handler, dentry, name, value, size, flags); 758 return handler->set(handler, dentry, inode, name, value, size, flags);
758} 759}
759 760
760/* 761/*
@@ -769,7 +770,8 @@ generic_removexattr(struct dentry *dentry, const char *name)
769 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 770 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
770 if (IS_ERR(handler)) 771 if (IS_ERR(handler))
771 return PTR_ERR(handler); 772 return PTR_ERR(handler);
772 return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE); 773 return handler->set(handler, dentry, d_inode(dentry), name, NULL,
774 0, XATTR_REPLACE);
773} 775}
774 776
775EXPORT_SYMBOL(generic_getxattr); 777EXPORT_SYMBOL(generic_getxattr);
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index ec58ff094b1d..ea62245fee26 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -74,11 +74,12 @@ xfs_forget_acl(
74} 74}
75 75
76static int 76static int
77xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, 77xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
78 const char *name, const void *value, size_t size, int flags) 78 struct inode *inode, const char *name, const void *value,
79 size_t size, int flags)
79{ 80{
80 int xflags = handler->flags; 81 int xflags = handler->flags;
81 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 82 struct xfs_inode *ip = XFS_I(inode);
82 int error; 83 int error;
83 84
84 /* Convert Linux syscall to XFS internal ATTR flags */ 85 /* Convert Linux syscall to XFS internal ATTR flags */
@@ -92,7 +93,7 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry,
92 error = xfs_attr_set(ip, (unsigned char *)name, 93 error = xfs_attr_set(ip, (unsigned char *)name,
93 (void *)value, size, xflags); 94 (void *)value, size, xflags);
94 if (!error) 95 if (!error)
95 xfs_forget_acl(d_inode(dentry), name, xflags); 96 xfs_forget_acl(inode, name, xflags);
96 97
97 return error; 98 return error;
98} 99}