aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-05-02 19:45:47 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-02 19:45:47 -0400
commit84695ffee7987ee1e581be4c4696e47e1a29403b (patch)
tree78ca09a96ecd6a6b5f4fae744c381968635af68d /fs
parentbf16200689118d19de1b8d2a3c314fc21f5dc7bb (diff)
parentce23e640133484eebc20ca7b7668388213e11327 (diff)
Merge getxattr prototype change into work.lookups
The rest of work.xattr stuff isn't needed for this branch
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/acl.c8
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/9p/xattr.c4
-rw-r--r--fs/bad_inode.c4
-rw-r--r--fs/btrfs/acl.c3
-rw-r--r--fs/btrfs/tree-log.c6
-rw-r--r--fs/btrfs/xattr.c6
-rw-r--r--fs/ceph/acl.c2
-rw-r--r--fs/ceph/super.h2
-rw-r--r--fs/ceph/xattr.c8
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/inode.c3
-rw-r--r--fs/cifs/readdir.c2
-rw-r--r--fs/cifs/xattr.c56
-rw-r--r--fs/ecryptfs/crypto.c5
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h4
-rw-r--r--fs/ecryptfs/inode.c23
-rw-r--r--fs/ecryptfs/mmap.c3
-rw-r--r--fs/efs/namei.c2
-rw-r--r--fs/exofs/super.c2
-rw-r--r--fs/ext2/acl.c3
-rw-r--r--fs/ext2/namei.c2
-rw-r--r--fs/ext2/xattr_security.c6
-rw-r--r--fs/ext2/xattr_trusted.c6
-rw-r--r--fs/ext2/xattr_user.c8
-rw-r--r--fs/ext4/acl.c3
-rw-r--r--fs/ext4/namei.c4
-rw-r--r--fs/ext4/xattr_security.c6
-rw-r--r--fs/ext4/xattr_trusted.c6
-rw-r--r--fs/ext4/xattr_user.c8
-rw-r--r--fs/f2fs/acl.c3
-rw-r--r--fs/f2fs/namei.c2
-rw-r--r--fs/f2fs/xattr.c14
-rw-r--r--fs/fuse/dir.c5
-rw-r--r--fs/gfs2/inode.c9
-rw-r--r--fs/gfs2/ops_fstype.c2
-rw-r--r--fs/gfs2/super.c2
-rw-r--r--fs/gfs2/xattr.c6
-rw-r--r--fs/hfs/attr.c5
-rw-r--r--fs/hfs/hfs_fs.h4
-rw-r--r--fs/hfsplus/posix_acl.c3
-rw-r--r--fs/hfsplus/xattr.c10
-rw-r--r--fs/hfsplus/xattr.h2
-rw-r--r--fs/hfsplus/xattr_security.c6
-rw-r--r--fs/hfsplus/xattr_trusted.c6
-rw-r--r--fs/hfsplus/xattr_user.c6
-rw-r--r--fs/inode.c4
-rw-r--r--fs/jffs2/acl.c2
-rw-r--r--fs/jffs2/dir.c2
-rw-r--r--fs/jffs2/security.c6
-rw-r--r--fs/jffs2/super.c2
-rw-r--r--fs/jffs2/xattr_trusted.c6
-rw-r--r--fs/jffs2/xattr_user.c6
-rw-r--r--fs/jfs/acl.c6
-rw-r--r--fs/jfs/jfs_xattr.h2
-rw-r--r--fs/jfs/namei.c2
-rw-r--r--fs/jfs/xattr.c8
-rw-r--r--fs/kernfs/inode.c6
-rw-r--r--fs/kernfs/kernfs-internal.h4
-rw-r--r--fs/libfs.c4
-rw-r--r--fs/namei.c6
-rw-r--r--fs/nfs/direct.c2
-rw-r--r--fs/nfs/nfs3acl.c43
-rw-r--r--fs/nfs/nfs4proc.c12
-rw-r--r--fs/nfsd/nfs3proc.c4
-rw-r--r--fs/nfsd/nfs3xdr.c2
-rw-r--r--fs/nfsd/nfsfh.c2
-rw-r--r--fs/nilfs2/namei.c2
-rw-r--r--fs/ocfs2/dlmglue.c3
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/ocfs2/xattr.c20
-rw-r--r--fs/orangefs/xattr.c10
-rw-r--r--fs/overlayfs/inode.c4
-rw-r--r--fs/overlayfs/overlayfs.h4
-rw-r--r--fs/overlayfs/super.c2
-rw-r--r--fs/posix_acl.c116
-rw-r--r--fs/reiserfs/file.c6
-rw-r--r--fs/reiserfs/namei.c18
-rw-r--r--fs/reiserfs/xattr.c54
-rw-r--r--fs/reiserfs/xattr.h9
-rw-r--r--fs/reiserfs/xattr_acl.c8
-rw-r--r--fs/reiserfs/xattr_security.c19
-rw-r--r--fs/reiserfs/xattr_trusted.c19
-rw-r--r--fs/reiserfs/xattr_user.c19
-rw-r--r--fs/squashfs/xattr.c6
-rw-r--r--fs/ubifs/ubifs.h4
-rw-r--r--fs/ubifs/xattr.c6
-rw-r--r--fs/udf/namei.c2
-rw-r--r--fs/ufs/super.c2
-rw-r--r--fs/xattr.c12
-rw-r--r--fs/xfs/xfs_acl.c20
-rw-r--r--fs/xfs/xfs_xattr.c6
93 files changed, 364 insertions, 426 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 9da967f38387..eb3589edf485 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -93,7 +93,7 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
93 * instantiating the inode (v9fs_inode_from_fid) 93 * instantiating the inode (v9fs_inode_from_fid)
94 */ 94 */
95 acl = get_cached_acl(inode, type); 95 acl = get_cached_acl(inode, type);
96 BUG_ON(acl == ACL_NOT_CACHED); 96 BUG_ON(is_uncached_acl(acl));
97 return acl; 97 return acl;
98} 98}
99 99
@@ -213,8 +213,8 @@ int v9fs_acl_mode(struct inode *dir, umode_t *modep,
213} 213}
214 214
215static int v9fs_xattr_get_acl(const struct xattr_handler *handler, 215static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
216 struct dentry *dentry, const char *name, 216 struct dentry *dentry, struct inode *inode,
217 void *buffer, size_t size) 217 const char *name, void *buffer, size_t size)
218{ 218{
219 struct v9fs_session_info *v9ses; 219 struct v9fs_session_info *v9ses;
220 struct posix_acl *acl; 220 struct posix_acl *acl;
@@ -227,7 +227,7 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
227 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) 227 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
228 return v9fs_xattr_get(dentry, handler->name, buffer, size); 228 return v9fs_xattr_get(dentry, handler->name, buffer, size);
229 229
230 acl = v9fs_get_cached_acl(d_inode(dentry), handler->flags); 230 acl = v9fs_get_cached_acl(inode, handler->flags);
231 if (IS_ERR(acl)) 231 if (IS_ERR(acl))
232 return PTR_ERR(acl); 232 return PTR_ERR(acl);
233 if (acl == NULL) 233 if (acl == NULL)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 3a08b3e6ff1d..f4645c515262 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1071,7 +1071,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1071 if (IS_ERR(st)) 1071 if (IS_ERR(st))
1072 return PTR_ERR(st); 1072 return PTR_ERR(st);
1073 1073
1074 v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb); 1074 v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb);
1075 generic_fillattr(d_inode(dentry), stat); 1075 generic_fillattr(d_inode(dentry), stat);
1076 1076
1077 p9stat_free(st); 1077 p9stat_free(st);
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 9dd9b47a6c1a..18c62bae9591 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -138,8 +138,8 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
138} 138}
139 139
140static int v9fs_xattr_handler_get(const struct xattr_handler *handler, 140static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
141 struct dentry *dentry, const char *name, 141 struct dentry *dentry, struct inode *inode,
142 void *buffer, size_t size) 142 const char *name, void *buffer, size_t size)
143{ 143{
144 const char *full_name = xattr_full_name(handler, name); 144 const char *full_name = xattr_full_name(handler, name);
145 145
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 103f5d7c3083..72e35b721608 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -106,8 +106,8 @@ static int bad_inode_setxattr(struct dentry *dentry, const char *name,
106 return -EIO; 106 return -EIO;
107} 107}
108 108
109static ssize_t bad_inode_getxattr(struct dentry *dentry, const char *name, 109static ssize_t bad_inode_getxattr(struct dentry *dentry, struct inode *inode,
110 void *buffer, size_t size) 110 const char *name, void *buffer, size_t size)
111{ 111{
112 return -EIO; 112 return -EIO;
113} 113}
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 6d263bb1621c..67a607709d4f 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -63,9 +63,6 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
63 } 63 }
64 kfree(value); 64 kfree(value);
65 65
66 if (!IS_ERR(acl))
67 set_cached_acl(inode, type, acl);
68
69 return acl; 66 return acl;
70} 67}
71 68
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 517d0ccb351e..e692eea87af6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -4988,7 +4988,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
4988 goto out; 4988 goto out;
4989 4989
4990 if (!S_ISDIR(inode->i_mode)) { 4990 if (!S_ISDIR(inode->i_mode)) {
4991 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 4991 if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
4992 goto out; 4992 goto out;
4993 inode = d_inode(parent); 4993 inode = d_inode(parent);
4994 } 4994 }
@@ -5009,7 +5009,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
5009 break; 5009 break;
5010 } 5010 }
5011 5011
5012 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 5012 if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
5013 break; 5013 break;
5014 5014
5015 if (IS_ROOT(parent)) 5015 if (IS_ROOT(parent))
@@ -5422,7 +5422,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
5422 } 5422 }
5423 5423
5424 while (1) { 5424 while (1) {
5425 if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb) 5425 if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
5426 break; 5426 break;
5427 5427
5428 inode = d_inode(parent); 5428 inode = d_inode(parent);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 145d2b89e62d..03224b00ea70 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -369,11 +369,9 @@ err:
369} 369}
370 370
371static int btrfs_xattr_handler_get(const struct xattr_handler *handler, 371static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
372 struct dentry *dentry, const char *name, 372 struct dentry *unused, struct inode *inode,
373 void *buffer, size_t size) 373 const char *name, void *buffer, size_t size)
374{ 374{
375 struct inode *inode = d_inode(dentry);
376
377 name = xattr_full_name(handler, name); 375 name = xattr_full_name(handler, name);
378 return __btrfs_getxattr(inode, name, buffer, size); 376 return __btrfs_getxattr(inode, name, buffer, size);
379} 377}
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
index f19708487e2f..5457f216e2e5 100644
--- a/fs/ceph/acl.c
+++ b/fs/ceph/acl.c
@@ -37,6 +37,8 @@ static inline void ceph_set_cached_acl(struct inode *inode,
37 spin_lock(&ci->i_ceph_lock); 37 spin_lock(&ci->i_ceph_lock);
38 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 0)) 38 if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 0))
39 set_cached_acl(inode, type, acl); 39 set_cached_acl(inode, type, acl);
40 else
41 forget_cached_acl(inode, type);
40 spin_unlock(&ci->i_ceph_lock); 42 spin_unlock(&ci->i_ceph_lock);
41} 43}
42 44
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index e705c4d612d7..beb893bb234f 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -795,7 +795,7 @@ extern int ceph_setxattr(struct dentry *, const char *, const void *,
795int __ceph_setxattr(struct dentry *, const char *, const void *, size_t, int); 795int __ceph_setxattr(struct dentry *, const char *, const void *, size_t, int);
796ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t); 796ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t);
797int __ceph_removexattr(struct dentry *, const char *); 797int __ceph_removexattr(struct dentry *, const char *);
798extern ssize_t ceph_getxattr(struct dentry *, const char *, void *, size_t); 798extern ssize_t ceph_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
799extern ssize_t ceph_listxattr(struct dentry *, char *, size_t); 799extern ssize_t ceph_listxattr(struct dentry *, char *, size_t);
800extern int ceph_removexattr(struct dentry *, const char *); 800extern int ceph_removexattr(struct dentry *, const char *);
801extern void __ceph_build_xattrs_blob(struct ceph_inode_info *ci); 801extern void __ceph_build_xattrs_blob(struct ceph_inode_info *ci);
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 9410abdef3ce..c6e917d360f7 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -804,13 +804,13 @@ out:
804 return err; 804 return err;
805} 805}
806 806
807ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value, 807ssize_t ceph_getxattr(struct dentry *dentry, struct inode *inode,
808 size_t size) 808 const char *name, void *value, size_t size)
809{ 809{
810 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 810 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
811 return generic_getxattr(dentry, name, value, size); 811 return generic_getxattr(dentry, inode, name, value, size);
812 812
813 return __ceph_getxattr(d_inode(dentry), name, value, size); 813 return __ceph_getxattr(inode, name, value, size);
814} 814}
815 815
816ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) 816ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index e956cba94338..94f2c8a9ae6d 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -302,7 +302,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
302 if (full_path == NULL) 302 if (full_path == NULL)
303 goto cdda_exit; 303 goto cdda_exit;
304 304
305 cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb); 305 cifs_sb = CIFS_SB(mntpt->d_sb);
306 tlink = cifs_sb_tlink(cifs_sb); 306 tlink = cifs_sb_tlink(cifs_sb);
307 if (IS_ERR(tlink)) { 307 if (IS_ERR(tlink)) {
308 mnt = ERR_CAST(tlink); 308 mnt = ERR_CAST(tlink);
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 83aac8ba50b0..c89ecd7a5c39 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -123,7 +123,7 @@ extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
123extern int cifs_removexattr(struct dentry *, const char *); 123extern int cifs_removexattr(struct dentry *, const char *);
124extern int cifs_setxattr(struct dentry *, const char *, const void *, 124extern int cifs_setxattr(struct dentry *, const char *, const void *,
125 size_t, int); 125 size_t, int);
126extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); 126extern ssize_t cifs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
127extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 127extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
128extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); 128extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
129#ifdef CONFIG_CIFS_NFSD_EXPORT 129#ifdef CONFIG_CIFS_NFSD_EXPORT
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5f9ad5c42180..514dadb0575d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2418,8 +2418,7 @@ cifs_setattr_exit:
2418int 2418int
2419cifs_setattr(struct dentry *direntry, struct iattr *attrs) 2419cifs_setattr(struct dentry *direntry, struct iattr *attrs)
2420{ 2420{
2421 struct inode *inode = d_inode(direntry); 2421 struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
2422 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
2423 struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb); 2422 struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);
2424 2423
2425 if (pTcon->unix_ext) 2424 if (pTcon->unix_ext)
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index b30a4a6d98a0..4cfb4d9f88e2 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -78,7 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
78{ 78{
79 struct dentry *dentry, *alias; 79 struct dentry *dentry, *alias;
80 struct inode *inode; 80 struct inode *inode;
81 struct super_block *sb = d_inode(parent)->i_sb; 81 struct super_block *sb = parent->d_sb;
82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 82 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
83 83
84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name); 84 cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index f5dc2f0df4ad..5d57c85703a9 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -42,21 +42,11 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
42 int rc = -EOPNOTSUPP; 42 int rc = -EOPNOTSUPP;
43#ifdef CONFIG_CIFS_XATTR 43#ifdef CONFIG_CIFS_XATTR
44 unsigned int xid; 44 unsigned int xid;
45 struct cifs_sb_info *cifs_sb; 45 struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
46 struct tcon_link *tlink; 46 struct tcon_link *tlink;
47 struct cifs_tcon *pTcon; 47 struct cifs_tcon *pTcon;
48 struct super_block *sb;
49 char *full_path = NULL; 48 char *full_path = NULL;
50 49
51 if (direntry == NULL)
52 return -EIO;
53 if (d_really_is_negative(direntry))
54 return -EIO;
55 sb = d_inode(direntry)->i_sb;
56 if (sb == NULL)
57 return -EIO;
58
59 cifs_sb = CIFS_SB(sb);
60 tlink = cifs_sb_tlink(cifs_sb); 50 tlink = cifs_sb_tlink(cifs_sb);
61 if (IS_ERR(tlink)) 51 if (IS_ERR(tlink))
62 return PTR_ERR(tlink); 52 return PTR_ERR(tlink);
@@ -103,21 +93,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
103 int rc = -EOPNOTSUPP; 93 int rc = -EOPNOTSUPP;
104#ifdef CONFIG_CIFS_XATTR 94#ifdef CONFIG_CIFS_XATTR
105 unsigned int xid; 95 unsigned int xid;
106 struct cifs_sb_info *cifs_sb; 96 struct super_block *sb = direntry->d_sb;
97 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
107 struct tcon_link *tlink; 98 struct tcon_link *tlink;
108 struct cifs_tcon *pTcon; 99 struct cifs_tcon *pTcon;
109 struct super_block *sb;
110 char *full_path; 100 char *full_path;
111 101
112 if (direntry == NULL)
113 return -EIO;
114 if (d_really_is_negative(direntry))
115 return -EIO;
116 sb = d_inode(direntry)->i_sb;
117 if (sb == NULL)
118 return -EIO;
119
120 cifs_sb = CIFS_SB(sb);
121 tlink = cifs_sb_tlink(cifs_sb); 102 tlink = cifs_sb_tlink(cifs_sb);
122 if (IS_ERR(tlink)) 103 if (IS_ERR(tlink))
123 return PTR_ERR(tlink); 104 return PTR_ERR(tlink);
@@ -232,27 +213,18 @@ set_ea_exit:
232 return rc; 213 return rc;
233} 214}
234 215
235ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, 216ssize_t cifs_getxattr(struct dentry *direntry, struct inode *inode,
236 void *ea_value, size_t buf_size) 217 const char *ea_name, void *ea_value, size_t buf_size)
237{ 218{
238 ssize_t rc = -EOPNOTSUPP; 219 ssize_t rc = -EOPNOTSUPP;
239#ifdef CONFIG_CIFS_XATTR 220#ifdef CONFIG_CIFS_XATTR
240 unsigned int xid; 221 unsigned int xid;
241 struct cifs_sb_info *cifs_sb; 222 struct super_block *sb = direntry->d_sb;
223 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
242 struct tcon_link *tlink; 224 struct tcon_link *tlink;
243 struct cifs_tcon *pTcon; 225 struct cifs_tcon *pTcon;
244 struct super_block *sb;
245 char *full_path; 226 char *full_path;
246 227
247 if (direntry == NULL)
248 return -EIO;
249 if (d_really_is_negative(direntry))
250 return -EIO;
251 sb = d_inode(direntry)->i_sb;
252 if (sb == NULL)
253 return -EIO;
254
255 cifs_sb = CIFS_SB(sb);
256 tlink = cifs_sb_tlink(cifs_sb); 228 tlink = cifs_sb_tlink(cifs_sb);
257 if (IS_ERR(tlink)) 229 if (IS_ERR(tlink))
258 return PTR_ERR(tlink); 230 return PTR_ERR(tlink);
@@ -324,7 +296,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
324 goto get_ea_exit; /* rc already EOPNOTSUPP */ 296 goto get_ea_exit; /* rc already EOPNOTSUPP */
325 297
326 pacl = pTcon->ses->server->ops->get_acl(cifs_sb, 298 pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
327 d_inode(direntry), full_path, &acllen); 299 inode, full_path, &acllen);
328 if (IS_ERR(pacl)) { 300 if (IS_ERR(pacl)) {
329 rc = PTR_ERR(pacl); 301 rc = PTR_ERR(pacl);
330 cifs_dbg(VFS, "%s: error %zd getting sec desc\n", 302 cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
@@ -374,21 +346,11 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
374 ssize_t rc = -EOPNOTSUPP; 346 ssize_t rc = -EOPNOTSUPP;
375#ifdef CONFIG_CIFS_XATTR 347#ifdef CONFIG_CIFS_XATTR
376 unsigned int xid; 348 unsigned int xid;
377 struct cifs_sb_info *cifs_sb; 349 struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
378 struct tcon_link *tlink; 350 struct tcon_link *tlink;
379 struct cifs_tcon *pTcon; 351 struct cifs_tcon *pTcon;
380 struct super_block *sb;
381 char *full_path; 352 char *full_path;
382 353
383 if (direntry == NULL)
384 return -EIO;
385 if (d_really_is_negative(direntry))
386 return -EIO;
387 sb = d_inode(direntry)->i_sb;
388 if (sb == NULL)
389 return -EIO;
390
391 cifs_sb = CIFS_SB(sb);
392 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 354 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
393 return -EOPNOTSUPP; 355 return -EOPNOTSUPP;
394 356
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index d09cb4cdd09f..8710093aae5e 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1369,7 +1369,9 @@ int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
1369 ssize_t size; 1369 ssize_t size;
1370 int rc = 0; 1370 int rc = 0;
1371 1371
1372 size = ecryptfs_getxattr_lower(lower_dentry, ECRYPTFS_XATTR_NAME, 1372 size = ecryptfs_getxattr_lower(lower_dentry,
1373 ecryptfs_inode_to_lower(ecryptfs_inode),
1374 ECRYPTFS_XATTR_NAME,
1373 page_virt, ECRYPTFS_DEFAULT_EXTENT_SIZE); 1375 page_virt, ECRYPTFS_DEFAULT_EXTENT_SIZE);
1374 if (size < 0) { 1376 if (size < 0) {
1375 if (unlikely(ecryptfs_verbosity > 0)) 1377 if (unlikely(ecryptfs_verbosity > 0))
@@ -1391,6 +1393,7 @@ int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry,
1391 int rc; 1393 int rc;
1392 1394
1393 rc = ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry), 1395 rc = ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry),
1396 ecryptfs_inode_to_lower(inode),
1394 ECRYPTFS_XATTR_NAME, file_size, 1397 ECRYPTFS_XATTR_NAME, file_size,
1395 ECRYPTFS_SIZE_AND_MARKER_BYTES); 1398 ECRYPTFS_SIZE_AND_MARKER_BYTES);
1396 if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES) 1399 if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index d123fbaa28e0..6ff907f73331 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -607,8 +607,8 @@ ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
607 unsigned char *src, struct dentry *ecryptfs_dentry); 607 unsigned char *src, struct dentry *ecryptfs_dentry);
608int ecryptfs_truncate(struct dentry *dentry, loff_t new_length); 608int ecryptfs_truncate(struct dentry *dentry, loff_t new_length);
609ssize_t 609ssize_t
610ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, 610ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode,
611 void *value, size_t size); 611 const char *name, void *value, size_t size);
612int 612int
613ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, 613ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
614 size_t size, int flags); 614 size_t size, int flags);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 224b49e71aa4..9323c536b2f2 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -1033,29 +1033,30 @@ out:
1033} 1033}
1034 1034
1035ssize_t 1035ssize_t
1036ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, 1036ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode,
1037 void *value, size_t size) 1037 const char *name, void *value, size_t size)
1038{ 1038{
1039 int rc = 0; 1039 int rc = 0;
1040 1040
1041 if (!d_inode(lower_dentry)->i_op->getxattr) { 1041 if (!lower_inode->i_op->getxattr) {
1042 rc = -EOPNOTSUPP; 1042 rc = -EOPNOTSUPP;
1043 goto out; 1043 goto out;
1044 } 1044 }
1045 inode_lock(d_inode(lower_dentry)); 1045 inode_lock(lower_inode);
1046 rc = d_inode(lower_dentry)->i_op->getxattr(lower_dentry, name, value, 1046 rc = lower_inode->i_op->getxattr(lower_dentry, lower_inode,
1047 size); 1047 name, value, size);
1048 inode_unlock(d_inode(lower_dentry)); 1048 inode_unlock(lower_inode);
1049out: 1049out:
1050 return rc; 1050 return rc;
1051} 1051}
1052 1052
1053static ssize_t 1053static ssize_t
1054ecryptfs_getxattr(struct dentry *dentry, const char *name, void *value, 1054ecryptfs_getxattr(struct dentry *dentry, struct inode *inode,
1055 size_t size) 1055 const char *name, void *value, size_t size)
1056{ 1056{
1057 return ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry), name, 1057 return ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry),
1058 value, size); 1058 ecryptfs_inode_to_lower(inode),
1059 name, value, size);
1059} 1060}
1060 1061
1061static ssize_t 1062static ssize_t
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index e6b1d80952b9..148d11b514fb 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -436,7 +436,8 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode)
436 goto out; 436 goto out;
437 } 437 }
438 inode_lock(lower_inode); 438 inode_lock(lower_inode);
439 size = lower_inode->i_op->getxattr(lower_dentry, ECRYPTFS_XATTR_NAME, 439 size = lower_inode->i_op->getxattr(lower_dentry, lower_inode,
440 ECRYPTFS_XATTR_NAME,
440 xattr_virt, PAGE_SIZE); 441 xattr_virt, PAGE_SIZE);
441 if (size < 0) 442 if (size < 0)
442 size = 8; 443 size = 8;
diff --git a/fs/efs/namei.c b/fs/efs/namei.c
index 40ba9cc41bf7..d34a40edcdb2 100644
--- a/fs/efs/namei.c
+++ b/fs/efs/namei.c
@@ -113,7 +113,7 @@ struct dentry *efs_get_parent(struct dentry *child)
113 113
114 ino = efs_find_entry(d_inode(child), "..", 2); 114 ino = efs_find_entry(d_inode(child), "..", 2);
115 if (ino) 115 if (ino)
116 parent = d_obtain_alias(efs_iget(d_inode(child)->i_sb, ino)); 116 parent = d_obtain_alias(efs_iget(child->d_sb, ino));
117 117
118 return parent; 118 return parent;
119} 119}
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 6658a50530a0..192373653dfb 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -958,7 +958,7 @@ static struct dentry *exofs_get_parent(struct dentry *child)
958 if (!ino) 958 if (!ino)
959 return ERR_PTR(-ESTALE); 959 return ERR_PTR(-ESTALE);
960 960
961 return d_obtain_alias(exofs_iget(d_inode(child)->i_sb, ino)); 961 return d_obtain_alias(exofs_iget(child->d_sb, ino));
962} 962}
963 963
964static struct inode *exofs_nfs_get_inode(struct super_block *sb, 964static struct inode *exofs_nfs_get_inode(struct super_block *sb,
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 27695e6f4e46..42f1d1814083 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -172,9 +172,6 @@ ext2_get_acl(struct inode *inode, int type)
172 acl = ERR_PTR(retval); 172 acl = ERR_PTR(retval);
173 kfree(value); 173 kfree(value);
174 174
175 if (!IS_ERR(acl))
176 set_cached_acl(inode, type, acl);
177
178 return acl; 175 return acl;
179} 176}
180 177
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index d34843925b23..d446203127fc 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -82,7 +82,7 @@ struct dentry *ext2_get_parent(struct dentry *child)
82 unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot); 82 unsigned long ino = ext2_inode_by_name(d_inode(child), &dotdot);
83 if (!ino) 83 if (!ino)
84 return ERR_PTR(-ENOENT); 84 return ERR_PTR(-ENOENT);
85 return d_obtain_alias(ext2_iget(d_inode(child)->i_sb, ino)); 85 return d_obtain_alias(ext2_iget(child->d_sb, ino));
86} 86}
87 87
88/* 88/*
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c
index ba97f243b050..7fd3b867ce65 100644
--- a/fs/ext2/xattr_security.c
+++ b/fs/ext2/xattr_security.c
@@ -9,10 +9,10 @@
9 9
10static int 10static int
11ext2_xattr_security_get(const struct xattr_handler *handler, 11ext2_xattr_security_get(const struct xattr_handler *handler,
12 struct dentry *dentry, const char *name, 12 struct dentry *unused, struct inode *inode,
13 void *buffer, size_t size) 13 const char *name, void *buffer, size_t size)
14{ 14{
15 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, 15 return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name,
16 buffer, size); 16 buffer, size);
17} 17}
18 18
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c
index 2c94d1930626..0f85705ff519 100644
--- a/fs/ext2/xattr_trusted.c
+++ b/fs/ext2/xattr_trusted.c
@@ -16,10 +16,10 @@ ext2_xattr_trusted_list(struct dentry *dentry)
16 16
17static int 17static int
18ext2_xattr_trusted_get(const struct xattr_handler *handler, 18ext2_xattr_trusted_get(const struct xattr_handler *handler,
19 struct dentry *dentry, const char *name, 19 struct dentry *unused, struct inode *inode,
20 void *buffer, size_t size) 20 const char *name, void *buffer, size_t size)
21{ 21{
22 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, 22 return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
23 buffer, size); 23 buffer, size);
24} 24}
25 25
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index 72a2a96d677f..1fafd27037cc 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -18,12 +18,12 @@ ext2_xattr_user_list(struct dentry *dentry)
18 18
19static int 19static int
20ext2_xattr_user_get(const struct xattr_handler *handler, 20ext2_xattr_user_get(const struct xattr_handler *handler,
21 struct dentry *dentry, const char *name, 21 struct dentry *unused, struct inode *inode,
22 void *buffer, size_t size) 22 const char *name, void *buffer, size_t size)
23{ 23{
24 if (!test_opt(dentry->d_sb, XATTR_USER)) 24 if (!test_opt(inode->i_sb, XATTR_USER))
25 return -EOPNOTSUPP; 25 return -EOPNOTSUPP;
26 return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER, 26 return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
27 name, buffer, size); 27 name, buffer, size);
28} 28}
29 29
diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c
index 69b1e73026a5..c6601a476c02 100644
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -172,9 +172,6 @@ ext4_get_acl(struct inode *inode, int type)
172 acl = ERR_PTR(retval); 172 acl = ERR_PTR(retval);
173 kfree(value); 173 kfree(value);
174 174
175 if (!IS_ERR(acl))
176 set_cached_acl(inode, type, acl);
177
178 return acl; 175 return acl;
179} 176}
180 177
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 48e4b8907826..5611ec9348d7 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1638,13 +1638,13 @@ struct dentry *ext4_get_parent(struct dentry *child)
1638 ino = le32_to_cpu(de->inode); 1638 ino = le32_to_cpu(de->inode);
1639 brelse(bh); 1639 brelse(bh);
1640 1640
1641 if (!ext4_valid_inum(d_inode(child)->i_sb, ino)) { 1641 if (!ext4_valid_inum(child->d_sb, ino)) {
1642 EXT4_ERROR_INODE(d_inode(child), 1642 EXT4_ERROR_INODE(d_inode(child),
1643 "bad parent inode number: %u", ino); 1643 "bad parent inode number: %u", ino);
1644 return ERR_PTR(-EFSCORRUPTED); 1644 return ERR_PTR(-EFSCORRUPTED);
1645 } 1645 }
1646 1646
1647 return d_obtain_alias(ext4_iget_normal(d_inode(child)->i_sb, ino)); 1647 return d_obtain_alias(ext4_iget_normal(child->d_sb, ino));
1648} 1648}
1649 1649
1650/* 1650/*
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index 3e81bdca071a..123a7d010efe 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -13,10 +13,10 @@
13 13
14static int 14static int
15ext4_xattr_security_get(const struct xattr_handler *handler, 15ext4_xattr_security_get(const struct xattr_handler *handler,
16 struct dentry *dentry, const char *name, 16 struct dentry *unused, struct inode *inode,
17 void *buffer, size_t size) 17 const char *name, void *buffer, size_t size)
18{ 18{
19 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, 19 return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY,
20 name, buffer, size); 20 name, buffer, size);
21} 21}
22 22
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index 2a3c6f9b8cb8..60652fa24cbc 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -20,10 +20,10 @@ ext4_xattr_trusted_list(struct dentry *dentry)
20 20
21static int 21static int
22ext4_xattr_trusted_get(const struct xattr_handler *handler, 22ext4_xattr_trusted_get(const struct xattr_handler *handler,
23 struct dentry *dentry, const char *name, void *buffer, 23 struct dentry *unused, struct inode *inode,
24 size_t size) 24 const char *name, void *buffer, size_t size)
25{ 25{
26 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, 26 return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED,
27 name, buffer, size); 27 name, buffer, size);
28} 28}
29 29
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index d152f431e432..17a446ffecd3 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -19,12 +19,12 @@ ext4_xattr_user_list(struct dentry *dentry)
19 19
20static int 20static int
21ext4_xattr_user_get(const struct xattr_handler *handler, 21ext4_xattr_user_get(const struct xattr_handler *handler,
22 struct dentry *dentry, const char *name, 22 struct dentry *unused, struct inode *inode,
23 void *buffer, size_t size) 23 const char *name, void *buffer, size_t size)
24{ 24{
25 if (!test_opt(dentry->d_sb, XATTR_USER)) 25 if (!test_opt(inode->i_sb, XATTR_USER))
26 return -EOPNOTSUPP; 26 return -EOPNOTSUPP;
27 return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER, 27 return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
28 name, buffer, size); 28 name, buffer, size);
29} 29}
30 30
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index c8f25f7241f0..6f1fdda977b3 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -190,9 +190,6 @@ static struct posix_acl *__f2fs_get_acl(struct inode *inode, int type,
190 acl = ERR_PTR(retval); 190 acl = ERR_PTR(retval);
191 kfree(value); 191 kfree(value);
192 192
193 if (!IS_ERR(acl))
194 set_cached_acl(inode, type, acl);
195
196 return acl; 193 return acl;
197} 194}
198 195
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 013e57932d61..324ed3812f30 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -202,7 +202,7 @@ struct dentry *f2fs_get_parent(struct dentry *child)
202 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot); 202 unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot);
203 if (!ino) 203 if (!ino)
204 return ERR_PTR(-ENOENT); 204 return ERR_PTR(-ENOENT);
205 return d_obtain_alias(f2fs_iget(d_inode(child)->i_sb, ino)); 205 return d_obtain_alias(f2fs_iget(child->d_sb, ino));
206} 206}
207 207
208static int __recover_dot_dentries(struct inode *dir, nid_t pino) 208static int __recover_dot_dentries(struct inode *dir, nid_t pino)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 06a72dc0191a..17fd2b1a6848 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -26,10 +26,10 @@
26#include "xattr.h" 26#include "xattr.h"
27 27
28static int f2fs_xattr_generic_get(const struct xattr_handler *handler, 28static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
29 struct dentry *dentry, const char *name, void *buffer, 29 struct dentry *unused, struct inode *inode,
30 size_t size) 30 const char *name, void *buffer, size_t size)
31{ 31{
32 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 32 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
33 33
34 switch (handler->flags) { 34 switch (handler->flags) {
35 case F2FS_XATTR_INDEX_USER: 35 case F2FS_XATTR_INDEX_USER:
@@ -45,7 +45,7 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
45 default: 45 default:
46 return -EINVAL; 46 return -EINVAL;
47 } 47 }
48 return f2fs_getxattr(d_inode(dentry), handler->flags, name, 48 return f2fs_getxattr(inode, handler->flags, name,
49 buffer, size, NULL); 49 buffer, size, NULL);
50} 50}
51 51
@@ -86,11 +86,9 @@ static bool f2fs_xattr_trusted_list(struct dentry *dentry)
86} 86}
87 87
88static int f2fs_xattr_advise_get(const struct xattr_handler *handler, 88static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
89 struct dentry *dentry, const char *name, void *buffer, 89 struct dentry *unused, struct inode *inode,
90 size_t size) 90 const char *name, void *buffer, size_t size)
91{ 91{
92 struct inode *inode = d_inode(dentry);
93
94 if (buffer) 92 if (buffer)
95 *((char *)buffer) = F2FS_I(inode)->i_advise; 93 *((char *)buffer) = F2FS_I(inode)->i_advise;
96 return sizeof(char); 94 return sizeof(char);
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 4b855b65d457..b618527c05c6 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1759,10 +1759,9 @@ static int fuse_setxattr(struct dentry *entry, const char *name,
1759 return err; 1759 return err;
1760} 1760}
1761 1761
1762static ssize_t fuse_getxattr(struct dentry *entry, const char *name, 1762static ssize_t fuse_getxattr(struct dentry *entry, struct inode *inode,
1763 void *value, size_t size) 1763 const char *name, void *value, size_t size)
1764{ 1764{
1765 struct inode *inode = d_inode(entry);
1766 struct fuse_conn *fc = get_fuse_conn(inode); 1765 struct fuse_conn *fc = get_fuse_conn(inode);
1767 FUSE_ARGS(args); 1766 FUSE_ARGS(args);
1768 struct fuse_getxattr_in inarg; 1767 struct fuse_getxattr_in inarg;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index bb30f9a72c65..45f516cada78 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1968,22 +1968,21 @@ static int gfs2_setxattr(struct dentry *dentry, const char *name,
1968 return ret; 1968 return ret;
1969} 1969}
1970 1970
1971static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, 1971static ssize_t gfs2_getxattr(struct dentry *dentry, struct inode *inode,
1972 void *data, size_t size) 1972 const char *name, void *data, size_t size)
1973{ 1973{
1974 struct inode *inode = d_inode(dentry);
1975 struct gfs2_inode *ip = GFS2_I(inode); 1974 struct gfs2_inode *ip = GFS2_I(inode);
1976 struct gfs2_holder gh; 1975 struct gfs2_holder gh;
1977 int ret; 1976 int ret;
1978 1977
1979 /* For selinux during lookup */ 1978 /* For selinux during lookup */
1980 if (gfs2_glock_is_locked_by_me(ip->i_gl)) 1979 if (gfs2_glock_is_locked_by_me(ip->i_gl))
1981 return generic_getxattr(dentry, name, data, size); 1980 return generic_getxattr(dentry, inode, name, data, size);
1982 1981
1983 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh); 1982 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &gh);
1984 ret = gfs2_glock_nq(&gh); 1983 ret = gfs2_glock_nq(&gh);
1985 if (ret == 0) { 1984 if (ret == 0) {
1986 ret = generic_getxattr(dentry, name, data, size); 1985 ret = generic_getxattr(dentry, inode, name, data, size);
1987 gfs2_glock_dq(&gh); 1986 gfs2_glock_dq(&gh);
1988 } 1987 }
1989 gfs2_holder_uninit(&gh); 1988 gfs2_holder_uninit(&gh);
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 49b0bff18fe3..c09c63dcd7a2 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1360,7 +1360,7 @@ static struct dentry *gfs2_mount_meta(struct file_system_type *fs_type,
1360 return ERR_PTR(error); 1360 return ERR_PTR(error);
1361 } 1361 }
1362 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags, 1362 s = sget(&gfs2_fs_type, test_gfs2_super, set_meta_super, flags,
1363 d_inode(path.dentry)->i_sb->s_bdev); 1363 path.dentry->d_sb->s_bdev);
1364 path_put(&path); 1364 path_put(&path);
1365 if (IS_ERR(s)) { 1365 if (IS_ERR(s)) {
1366 pr_warn("gfs2 mount does not exist\n"); 1366 pr_warn("gfs2 mount does not exist\n");
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index f8a0cd821290..9b2ff353e45f 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1176,7 +1176,7 @@ static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *s
1176 1176
1177static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf) 1177static int gfs2_statfs(struct dentry *dentry, struct kstatfs *buf)
1178{ 1178{
1179 struct super_block *sb = d_inode(dentry)->i_sb; 1179 struct super_block *sb = dentry->d_sb;
1180 struct gfs2_sbd *sdp = sb->s_fs_info; 1180 struct gfs2_sbd *sdp = sb->s_fs_info;
1181 struct gfs2_statfs_change_host sc; 1181 struct gfs2_statfs_change_host sc;
1182 int error; 1182 int error;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index e8dfb4740c04..619886ba6e78 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -584,10 +584,10 @@ out:
584 * Returns: actual size of data on success, -errno on error 584 * Returns: actual size of data on success, -errno on error
585 */ 585 */
586static int gfs2_xattr_get(const struct xattr_handler *handler, 586static int gfs2_xattr_get(const struct xattr_handler *handler,
587 struct dentry *dentry, const char *name, 587 struct dentry *unused, struct inode *inode,
588 void *buffer, size_t size) 588 const char *name, void *buffer, size_t size)
589{ 589{
590 struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); 590 struct gfs2_inode *ip = GFS2_I(inode);
591 struct gfs2_ea_location el; 591 struct gfs2_ea_location el;
592 int type = handler->flags; 592 int type = handler->flags;
593 int error; 593 int error;
diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c
index 8d931b157bbe..064f92f17efc 100644
--- a/fs/hfs/attr.c
+++ b/fs/hfs/attr.c
@@ -56,10 +56,9 @@ out:
56 return res; 56 return res;
57} 57}
58 58
59ssize_t hfs_getxattr(struct dentry *dentry, const char *name, 59ssize_t hfs_getxattr(struct dentry *unused, struct inode *inode,
60 void *value, size_t size) 60 const char *name, void *value, size_t size)
61{ 61{
62 struct inode *inode = d_inode(dentry);
63 struct hfs_find_data fd; 62 struct hfs_find_data fd;
64 hfs_cat_rec rec; 63 hfs_cat_rec rec;
65 struct hfs_cat_file *file; 64 struct hfs_cat_file *file;
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 1f1c7dcbcc2f..79daa097929a 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -213,8 +213,8 @@ extern void hfs_delete_inode(struct inode *);
213/* attr.c */ 213/* attr.c */
214extern int hfs_setxattr(struct dentry *dentry, const char *name, 214extern int hfs_setxattr(struct dentry *dentry, const char *name,
215 const void *value, size_t size, int flags); 215 const void *value, size_t size, int flags);
216extern ssize_t hfs_getxattr(struct dentry *dentry, const char *name, 216extern ssize_t hfs_getxattr(struct dentry *dentry, struct inode *inode,
217 void *value, size_t size); 217 const char *name, void *value, size_t size);
218extern ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 218extern ssize_t hfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
219 219
220/* mdb.c */ 220/* mdb.c */
diff --git a/fs/hfsplus/posix_acl.c b/fs/hfsplus/posix_acl.c
index afb33eda6d7d..ab7ea2506b4d 100644
--- a/fs/hfsplus/posix_acl.c
+++ b/fs/hfsplus/posix_acl.c
@@ -48,9 +48,6 @@ struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type)
48 48
49 hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value); 49 hfsplus_destroy_attr_entry((hfsplus_attr_entry *)value);
50 50
51 if (!IS_ERR(acl))
52 set_cached_acl(inode, type, acl);
53
54 return acl; 51 return acl;
55} 52}
56 53
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index 70e445ff0cff..4f118d282a7a 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -579,7 +579,7 @@ failed_getxattr_init:
579 return res; 579 return res;
580} 580}
581 581
582ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, 582ssize_t hfsplus_getxattr(struct inode *inode, const char *name,
583 void *value, size_t size, 583 void *value, size_t size,
584 const char *prefix, size_t prefixlen) 584 const char *prefix, size_t prefixlen)
585{ 585{
@@ -594,7 +594,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
594 strcpy(xattr_name, prefix); 594 strcpy(xattr_name, prefix);
595 strcpy(xattr_name + prefixlen, name); 595 strcpy(xattr_name + prefixlen, name);
596 596
597 res = __hfsplus_getxattr(d_inode(dentry), xattr_name, value, size); 597 res = __hfsplus_getxattr(inode, xattr_name, value, size);
598 kfree(xattr_name); 598 kfree(xattr_name);
599 return res; 599 return res;
600 600
@@ -844,8 +844,8 @@ end_removexattr:
844} 844}
845 845
846static int hfsplus_osx_getxattr(const struct xattr_handler *handler, 846static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
847 struct dentry *dentry, const char *name, 847 struct dentry *unused, struct inode *inode,
848 void *buffer, size_t size) 848 const char *name, void *buffer, size_t size)
849{ 849{
850 /* 850 /*
851 * Don't allow retrieving properly prefixed attributes 851 * Don't allow retrieving properly prefixed attributes
@@ -860,7 +860,7 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
860 * creates), so we pass the name through unmodified (after 860 * creates), so we pass the name through unmodified (after
861 * ensuring it doesn't conflict with another namespace). 861 * ensuring it doesn't conflict with another namespace).
862 */ 862 */
863 return __hfsplus_getxattr(d_inode(dentry), name, buffer, size); 863 return __hfsplus_getxattr(inode, name, buffer, size);
864} 864}
865 865
866static int hfsplus_osx_setxattr(const struct xattr_handler *handler, 866static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index f9b0955b3d28..d04ba6f58df2 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -28,7 +28,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
28ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, 28ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
29 void *value, size_t size); 29 void *value, size_t size);
30 30
31ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, 31ssize_t hfsplus_getxattr(struct inode *inode, const char *name,
32 void *value, size_t size, 32 void *value, size_t size,
33 const char *prefix, size_t prefixlen); 33 const char *prefix, size_t prefixlen);
34 34
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c
index 72a68a3a0c99..ae2ca8c2e335 100644
--- a/fs/hfsplus/xattr_security.c
+++ b/fs/hfsplus/xattr_security.c
@@ -14,10 +14,10 @@
14#include "acl.h" 14#include "acl.h"
15 15
16static int hfsplus_security_getxattr(const struct xattr_handler *handler, 16static int hfsplus_security_getxattr(const struct xattr_handler *handler,
17 struct dentry *dentry, const char *name, 17 struct dentry *unused, struct inode *inode,
18 void *buffer, size_t size) 18 const char *name, void *buffer, size_t size)
19{ 19{
20 return hfsplus_getxattr(dentry, name, buffer, size, 20 return hfsplus_getxattr(inode, name, buffer, size,
21 XATTR_SECURITY_PREFIX, 21 XATTR_SECURITY_PREFIX,
22 XATTR_SECURITY_PREFIX_LEN); 22 XATTR_SECURITY_PREFIX_LEN);
23} 23}
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c
index 95a7704c7abb..eae2947060aa 100644
--- a/fs/hfsplus/xattr_trusted.c
+++ b/fs/hfsplus/xattr_trusted.c
@@ -12,10 +12,10 @@
12#include "xattr.h" 12#include "xattr.h"
13 13
14static int hfsplus_trusted_getxattr(const struct xattr_handler *handler, 14static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
15 struct dentry *dentry, const char *name, 15 struct dentry *unused, struct inode *inode,
16 void *buffer, size_t size) 16 const char *name, void *buffer, size_t size)
17{ 17{
18 return hfsplus_getxattr(dentry, name, buffer, size, 18 return hfsplus_getxattr(inode, name, buffer, size,
19 XATTR_TRUSTED_PREFIX, 19 XATTR_TRUSTED_PREFIX,
20 XATTR_TRUSTED_PREFIX_LEN); 20 XATTR_TRUSTED_PREFIX_LEN);
21} 21}
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c
index 6fc269baf959..3c9eec3e4c7b 100644
--- a/fs/hfsplus/xattr_user.c
+++ b/fs/hfsplus/xattr_user.c
@@ -12,11 +12,11 @@
12#include "xattr.h" 12#include "xattr.h"
13 13
14static int hfsplus_user_getxattr(const struct xattr_handler *handler, 14static int hfsplus_user_getxattr(const struct xattr_handler *handler,
15 struct dentry *dentry, const char *name, 15 struct dentry *unused, struct inode *inode,
16 void *buffer, size_t size) 16 const char *name, void *buffer, size_t size)
17{ 17{
18 18
19 return hfsplus_getxattr(dentry, name, buffer, size, 19 return hfsplus_getxattr(inode, name, buffer, size,
20 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 20 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
21} 21}
22 22
diff --git a/fs/inode.c b/fs/inode.c
index 69b8b526c194..4202aac99464 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -238,9 +238,9 @@ void __destroy_inode(struct inode *inode)
238 } 238 }
239 239
240#ifdef CONFIG_FS_POSIX_ACL 240#ifdef CONFIG_FS_POSIX_ACL
241 if (inode->i_acl && inode->i_acl != ACL_NOT_CACHED) 241 if (inode->i_acl && !is_uncached_acl(inode->i_acl))
242 posix_acl_release(inode->i_acl); 242 posix_acl_release(inode->i_acl);
243 if (inode->i_default_acl && inode->i_default_acl != ACL_NOT_CACHED) 243 if (inode->i_default_acl && !is_uncached_acl(inode->i_default_acl))
244 posix_acl_release(inode->i_default_acl); 244 posix_acl_release(inode->i_default_acl);
245#endif 245#endif
246 this_cpu_dec(nr_inodes); 246 this_cpu_dec(nr_inodes);
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 2f7a3c090489..bc2693d56298 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -203,8 +203,6 @@ struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
203 acl = ERR_PTR(rc); 203 acl = ERR_PTR(rc);
204 } 204 }
205 kfree(value); 205 kfree(value);
206 if (!IS_ERR(acl))
207 set_cached_acl(inode, type, acl);
208 return acl; 206 return acl;
209} 207}
210 208
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 30c4c9ebb693..7a9579e03dbb 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -241,7 +241,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
241 241
242static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry) 242static int jffs2_link (struct dentry *old_dentry, struct inode *dir_i, struct dentry *dentry)
243{ 243{
244 struct jffs2_sb_info *c = JFFS2_SB_INFO(d_inode(old_dentry)->i_sb); 244 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dentry->d_sb);
245 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry)); 245 struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode(old_dentry));
246 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 246 struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i);
247 int ret; 247 int ret;
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index 7a28facd7175..3ed9a4b49778 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -49,10 +49,10 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
49 49
50/* ---- XATTR Handler for "security.*" ----------------- */ 50/* ---- XATTR Handler for "security.*" ----------------- */
51static int jffs2_security_getxattr(const struct xattr_handler *handler, 51static int jffs2_security_getxattr(const struct xattr_handler *handler,
52 struct dentry *dentry, const char *name, 52 struct dentry *unused, struct inode *inode,
53 void *buffer, size_t size) 53 const char *name, void *buffer, size_t size)
54{ 54{
55 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, 55 return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY,
56 name, buffer, size); 56 name, buffer, size);
57} 57}
58 58
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 0a9a114bb9d1..5ef21f4c4c77 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -147,7 +147,7 @@ static struct dentry *jffs2_get_parent(struct dentry *child)
147 JFFS2_DEBUG("Parent of directory ino #%u is #%u\n", 147 JFFS2_DEBUG("Parent of directory ino #%u is #%u\n",
148 f->inocache->ino, pino); 148 f->inocache->ino, pino);
149 149
150 return d_obtain_alias(jffs2_iget(d_inode(child)->i_sb, pino)); 150 return d_obtain_alias(jffs2_iget(child->d_sb, pino));
151} 151}
152 152
153static const struct export_operations jffs2_export_ops = { 153static const struct export_operations jffs2_export_ops = {
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index b2555ef07a12..4ebecff1d922 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -17,10 +17,10 @@
17#include "nodelist.h" 17#include "nodelist.h"
18 18
19static int jffs2_trusted_getxattr(const struct xattr_handler *handler, 19static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
20 struct dentry *dentry, const char *name, 20 struct dentry *unused, struct inode *inode,
21 void *buffer, size_t size) 21 const char *name, void *buffer, size_t size)
22{ 22{
23 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, 23 return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
24 name, buffer, size); 24 name, buffer, size);
25} 25}
26 26
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c
index 539bd630b5e4..bce249e1b277 100644
--- a/fs/jffs2/xattr_user.c
+++ b/fs/jffs2/xattr_user.c
@@ -17,10 +17,10 @@
17#include "nodelist.h" 17#include "nodelist.h"
18 18
19static int jffs2_user_getxattr(const struct xattr_handler *handler, 19static int jffs2_user_getxattr(const struct xattr_handler *handler,
20 struct dentry *dentry, const char *name, 20 struct dentry *unused, struct inode *inode,
21 void *buffer, size_t size) 21 const char *name, void *buffer, size_t size)
22{ 22{
23 return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER, 23 return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER,
24 name, buffer, size); 24 name, buffer, size);
25} 25}
26 26
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 49456853e9de..21fa92ba2c19 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -34,10 +34,6 @@ struct posix_acl *jfs_get_acl(struct inode *inode, int type)
34 int size; 34 int size;
35 char *value = NULL; 35 char *value = NULL;
36 36
37 acl = get_cached_acl(inode, type);
38 if (acl != ACL_NOT_CACHED)
39 return acl;
40
41 switch(type) { 37 switch(type) {
42 case ACL_TYPE_ACCESS: 38 case ACL_TYPE_ACCESS:
43 ea_name = XATTR_NAME_POSIX_ACL_ACCESS; 39 ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
@@ -67,8 +63,6 @@ struct posix_acl *jfs_get_acl(struct inode *inode, int type)
67 acl = posix_acl_from_xattr(&init_user_ns, value, size); 63 acl = posix_acl_from_xattr(&init_user_ns, value, size);
68 } 64 }
69 kfree(value); 65 kfree(value);
70 if (!IS_ERR(acl))
71 set_cached_acl(inode, type, acl);
72 return acl; 66 return acl;
73} 67}
74 68
diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h
index e8d717dabca3..e69e14f3777b 100644
--- a/fs/jfs/jfs_xattr.h
+++ b/fs/jfs/jfs_xattr.h
@@ -57,7 +57,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
57extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t, 57extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
58 int); 58 int);
59extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t); 59extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
60extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t); 60extern ssize_t jfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
61extern ssize_t jfs_listxattr(struct dentry *, char *, size_t); 61extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
62extern int jfs_removexattr(struct dentry *, const char *); 62extern int jfs_removexattr(struct dentry *, const char *);
63 63
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 701f89370de7..8a40941ac9a6 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1524,7 +1524,7 @@ struct dentry *jfs_get_parent(struct dentry *dentry)
1524 parent_ino = 1524 parent_ino =
1525 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot); 1525 le32_to_cpu(JFS_IP(d_inode(dentry))->i_dtroot.header.idotdot);
1526 1526
1527 return d_obtain_alias(jfs_iget(d_inode(dentry)->i_sb, parent_ino)); 1527 return d_obtain_alias(jfs_iget(dentry->d_sb, parent_ino));
1528} 1528}
1529 1529
1530const struct inode_operations jfs_dir_inode_operations = { 1530const struct inode_operations jfs_dir_inode_operations = {
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 48b15a6e5558..5becc6a3ff8c 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -933,8 +933,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
933 return size; 933 return size;
934} 934}
935 935
936ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data, 936ssize_t jfs_getxattr(struct dentry *dentry, struct inode *inode,
937 size_t buf_size) 937 const char *name, void *data, size_t buf_size)
938{ 938{
939 int err; 939 int err;
940 940
@@ -944,7 +944,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
944 * for it via sb->s_xattr. 944 * for it via sb->s_xattr.
945 */ 945 */
946 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) 946 if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
947 return generic_getxattr(dentry, name, data, buf_size); 947 return generic_getxattr(dentry, inode, name, data, buf_size);
948 948
949 if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { 949 if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) {
950 /* 950 /*
@@ -959,7 +959,7 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
959 return -EOPNOTSUPP; 959 return -EOPNOTSUPP;
960 } 960 }
961 961
962 err = __jfs_getxattr(d_inode(dentry), name, data, buf_size); 962 err = __jfs_getxattr(inode, name, data, buf_size);
963 963
964 return err; 964 return err;
965} 965}
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 16405ae88d2d..b5247226732b 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -208,10 +208,10 @@ int kernfs_iop_removexattr(struct dentry *dentry, const char *name)
208 return simple_xattr_set(&attrs->xattrs, name, NULL, 0, XATTR_REPLACE); 208 return simple_xattr_set(&attrs->xattrs, name, NULL, 0, XATTR_REPLACE);
209} 209}
210 210
211ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf, 211ssize_t kernfs_iop_getxattr(struct dentry *unused, struct inode *inode,
212 size_t size) 212 const char *name, void *buf, size_t size)
213{ 213{
214 struct kernfs_node *kn = dentry->d_fsdata; 214 struct kernfs_node *kn = inode->i_private;
215 struct kernfs_iattrs *attrs; 215 struct kernfs_iattrs *attrs;
216 216
217 attrs = kernfs_iattrs(kn); 217 attrs = kernfs_iattrs(kn);
diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h
index 6762bfbd8207..45c9192c276e 100644
--- a/fs/kernfs/kernfs-internal.h
+++ b/fs/kernfs/kernfs-internal.h
@@ -84,8 +84,8 @@ int kernfs_iop_getattr(struct vfsmount *mnt, struct dentry *dentry,
84int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value, 84int kernfs_iop_setxattr(struct dentry *dentry, const char *name, const void *value,
85 size_t size, int flags); 85 size_t size, int flags);
86int kernfs_iop_removexattr(struct dentry *dentry, const char *name); 86int kernfs_iop_removexattr(struct dentry *dentry, const char *name);
87ssize_t kernfs_iop_getxattr(struct dentry *dentry, const char *name, void *buf, 87ssize_t kernfs_iop_getxattr(struct dentry *dentry, struct inode *inode,
88 size_t size); 88 const char *name, void *buf, size_t size);
89ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size); 89ssize_t kernfs_iop_listxattr(struct dentry *dentry, char *buf, size_t size);
90 90
91/* 91/*
diff --git a/fs/libfs.c b/fs/libfs.c
index f3fa82ce9b70..43dd28031a1a 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1127,8 +1127,8 @@ static int empty_dir_setxattr(struct dentry *dentry, const char *name,
1127 return -EOPNOTSUPP; 1127 return -EOPNOTSUPP;
1128} 1128}
1129 1129
1130static ssize_t empty_dir_getxattr(struct dentry *dentry, const char *name, 1130static ssize_t empty_dir_getxattr(struct dentry *dentry, struct inode *inode,
1131 void *value, size_t size) 1131 const char *name, void *value, size_t size)
1132{ 1132{
1133 return -EOPNOTSUPP; 1133 return -EOPNOTSUPP;
1134} 1134}
diff --git a/fs/namei.c b/fs/namei.c
index 1d9ca2d5dff6..bdcea8a018b8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -265,7 +265,7 @@ static int check_acl(struct inode *inode, int mask)
265 if (!acl) 265 if (!acl)
266 return -EAGAIN; 266 return -EAGAIN;
267 /* no ->get_acl() calls in RCU mode... */ 267 /* no ->get_acl() calls in RCU mode... */
268 if (acl == ACL_NOT_CACHED) 268 if (is_uncached_acl(acl))
269 return -ECHILD; 269 return -ECHILD;
270 return posix_acl_permission(inode, acl, mask & ~MAY_NOT_BLOCK); 270 return posix_acl_permission(inode, acl, mask & ~MAY_NOT_BLOCK);
271 } 271 }
@@ -2655,7 +2655,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
2655 return NULL; 2655 return NULL;
2656 } 2656 }
2657 2657
2658 mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex); 2658 mutex_lock(&p1->d_sb->s_vfs_rename_mutex);
2659 2659
2660 p = d_ancestor(p2, p1); 2660 p = d_ancestor(p2, p1);
2661 if (p) { 2661 if (p) {
@@ -2682,7 +2682,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
2682 inode_unlock(p1->d_inode); 2682 inode_unlock(p1->d_inode);
2683 if (p1 != p2) { 2683 if (p1 != p2) {
2684 inode_unlock(p2->d_inode); 2684 inode_unlock(p2->d_inode);
2685 mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); 2685 mutex_unlock(&p1->d_sb->s_vfs_rename_mutex);
2686 } 2686 }
2687} 2687}
2688EXPORT_SYMBOL(unlock_rename); 2688EXPORT_SYMBOL(unlock_rename);
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index c93826e4a8c6..438d4e70742f 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -396,7 +396,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
396static void nfs_direct_readpage_release(struct nfs_page *req) 396static void nfs_direct_readpage_release(struct nfs_page *req)
397{ 397{
398 dprintk("NFS: direct read done (%s/%llu %d@%lld)\n", 398 dprintk("NFS: direct read done (%s/%llu %d@%lld)\n",
399 d_inode(req->wb_context->dentry)->i_sb->s_id, 399 req->wb_context->dentry->d_sb->s_id,
400 (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)), 400 (unsigned long long)NFS_FILEID(d_inode(req->wb_context->dentry)),
401 req->wb_bytes, 401 req->wb_bytes,
402 (long long)req_offset(req)); 402 (long long)req_offset(req));
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 17c0fa1eccfa..720d92f5abfb 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -11,6 +11,38 @@
11 11
12#define NFSDBG_FACILITY NFSDBG_PROC 12#define NFSDBG_FACILITY NFSDBG_PROC
13 13
14/*
15 * nfs3_prepare_get_acl, nfs3_complete_get_acl, nfs3_abort_get_acl: Helpers for
16 * caching get_acl results in a race-free way. See fs/posix_acl.c:get_acl()
17 * for explanations.
18 */
19static void nfs3_prepare_get_acl(struct posix_acl **p)
20{
21 struct posix_acl *sentinel = uncached_acl_sentinel(current);
22
23 if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED) {
24 /* Not the first reader or sentinel already in place. */
25 }
26}
27
28static void nfs3_complete_get_acl(struct posix_acl **p, struct posix_acl *acl)
29{
30 struct posix_acl *sentinel = uncached_acl_sentinel(current);
31
32 /* Only cache the ACL if our sentinel is still in place. */
33 posix_acl_dup(acl);
34 if (cmpxchg(p, sentinel, acl) != sentinel)
35 posix_acl_release(acl);
36}
37
38static void nfs3_abort_get_acl(struct posix_acl **p)
39{
40 struct posix_acl *sentinel = uncached_acl_sentinel(current);
41
42 /* Remove our sentinel upon failure. */
43 cmpxchg(p, sentinel, ACL_NOT_CACHED);
44}
45
14struct posix_acl *nfs3_get_acl(struct inode *inode, int type) 46struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
15{ 47{
16 struct nfs_server *server = NFS_SERVER(inode); 48 struct nfs_server *server = NFS_SERVER(inode);
@@ -55,6 +87,11 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
55 if (res.fattr == NULL) 87 if (res.fattr == NULL)
56 return ERR_PTR(-ENOMEM); 88 return ERR_PTR(-ENOMEM);
57 89
90 if (args.mask & NFS_ACL)
91 nfs3_prepare_get_acl(&inode->i_acl);
92 if (args.mask & NFS_DFACL)
93 nfs3_prepare_get_acl(&inode->i_default_acl);
94
58 status = rpc_call_sync(server->client_acl, &msg, 0); 95 status = rpc_call_sync(server->client_acl, &msg, 0);
59 dprintk("NFS reply getacl: %d\n", status); 96 dprintk("NFS reply getacl: %d\n", status);
60 97
@@ -89,12 +126,12 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
89 } 126 }
90 127
91 if (res.mask & NFS_ACL) 128 if (res.mask & NFS_ACL)
92 set_cached_acl(inode, ACL_TYPE_ACCESS, res.acl_access); 129 nfs3_complete_get_acl(&inode->i_acl, res.acl_access);
93 else 130 else
94 forget_cached_acl(inode, ACL_TYPE_ACCESS); 131 forget_cached_acl(inode, ACL_TYPE_ACCESS);
95 132
96 if (res.mask & NFS_DFACL) 133 if (res.mask & NFS_DFACL)
97 set_cached_acl(inode, ACL_TYPE_DEFAULT, res.acl_default); 134 nfs3_complete_get_acl(&inode->i_default_acl, res.acl_default);
98 else 135 else
99 forget_cached_acl(inode, ACL_TYPE_DEFAULT); 136 forget_cached_acl(inode, ACL_TYPE_DEFAULT);
100 137
@@ -108,6 +145,8 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
108 } 145 }
109 146
110getout: 147getout:
148 nfs3_abort_get_acl(&inode->i_acl);
149 nfs3_abort_get_acl(&inode->i_default_acl);
111 posix_acl_release(res.acl_access); 150 posix_acl_release(res.acl_access);
112 posix_acl_release(res.acl_default); 151 posix_acl_release(res.acl_default);
113 nfs_free_fattr(res.fattr); 152 nfs_free_fattr(res.fattr);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 327b8c34d360..7a7ac1dafa02 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6263,10 +6263,10 @@ static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
6263} 6263}
6264 6264
6265static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler, 6265static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
6266 struct dentry *dentry, const char *key, 6266 struct dentry *unused, struct inode *inode,
6267 void *buf, size_t buflen) 6267 const char *key, void *buf, size_t buflen)
6268{ 6268{
6269 return nfs4_proc_get_acl(d_inode(dentry), buf, buflen); 6269 return nfs4_proc_get_acl(inode, buf, buflen);
6270} 6270}
6271 6271
6272static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry) 6272static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)
@@ -6288,11 +6288,11 @@ static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
6288} 6288}
6289 6289
6290static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler, 6290static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler,
6291 struct dentry *dentry, const char *key, 6291 struct dentry *unused, struct inode *inode,
6292 void *buf, size_t buflen) 6292 const char *key, void *buf, size_t buflen)
6293{ 6293{
6294 if (security_ismaclabel(key)) 6294 if (security_ismaclabel(key))
6295 return nfs4_get_security_label(d_inode(dentry), buf, buflen); 6295 return nfs4_get_security_label(inode, buf, buflen);
6296 return -EOPNOTSUPP; 6296 return -EOPNOTSUPP;
6297} 6297}
6298 6298
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 51c3b06e8036..d818e4ffd79f 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -552,7 +552,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
552 * different read/write sizes for file systems known to have 552 * different read/write sizes for file systems known to have
553 * problems with large blocks */ 553 * problems with large blocks */
554 if (nfserr == 0) { 554 if (nfserr == 0) {
555 struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; 555 struct super_block *sb = argp->fh.fh_dentry->d_sb;
556 556
557 /* Note that we don't care for remote fs's here */ 557 /* Note that we don't care for remote fs's here */
558 if (sb->s_magic == MSDOS_SUPER_MAGIC) { 558 if (sb->s_magic == MSDOS_SUPER_MAGIC) {
@@ -588,7 +588,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
588 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); 588 nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP);
589 589
590 if (nfserr == 0) { 590 if (nfserr == 0) {
591 struct super_block *sb = d_inode(argp->fh.fh_dentry)->i_sb; 591 struct super_block *sb = argp->fh.fh_dentry->d_sb;
592 592
593 /* Note that we don't care for remote fs's here */ 593 /* Note that we don't care for remote fs's here */
594 switch (sb->s_magic) { 594 switch (sb->s_magic) {
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 2246454dec76..93d5853f8c99 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
146 default: 146 default:
147 case FSIDSOURCE_DEV: 147 case FSIDSOURCE_DEV:
148 p = xdr_encode_hyper(p, (u64)huge_encode_dev 148 p = xdr_encode_hyper(p, (u64)huge_encode_dev
149 (d_inode(fhp->fh_dentry)->i_sb->s_dev)); 149 (fhp->fh_dentry->d_sb->s_dev));
150 break; 150 break;
151 case FSIDSOURCE_FSID: 151 case FSIDSOURCE_FSID:
152 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); 152 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index c1681ce894c5..a8919444c460 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -426,7 +426,7 @@ static bool is_root_export(struct svc_export *exp)
426 426
427static struct super_block *exp_sb(struct svc_export *exp) 427static struct super_block *exp_sb(struct svc_export *exp)
428{ 428{
429 return d_inode(exp->ex_path.dentry)->i_sb; 429 return exp->ex_path.dentry->d_sb;
430} 430}
431 431
432static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp) 432static bool fsid_type_ok_for_exp(u8 fsid_type, struct svc_export *exp)
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index 151bc19d47c0..3b2af05f9fb4 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -457,7 +457,7 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
457 457
458 root = NILFS_I(d_inode(child))->i_root; 458 root = NILFS_I(d_inode(child))->i_root;
459 459
460 inode = nilfs_iget(d_inode(child)->i_sb, root, ino); 460 inode = nilfs_iget(child->d_sb, root, ino);
461 if (IS_ERR(inode)) 461 if (IS_ERR(inode))
462 return ERR_CAST(inode); 462 return ERR_CAST(inode);
463 463
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 474e57f834e6..1eaa9100c889 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -54,6 +54,7 @@
54#include "uptodate.h" 54#include "uptodate.h"
55#include "quota.h" 55#include "quota.h"
56#include "refcounttree.h" 56#include "refcounttree.h"
57#include "acl.h"
57 58
58#include "buffer_head_io.h" 59#include "buffer_head_io.h"
59 60
@@ -3623,6 +3624,8 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
3623 filemap_fdatawait(mapping); 3624 filemap_fdatawait(mapping);
3624 } 3625 }
3625 3626
3627 forget_all_cached_acls(inode);
3628
3626out: 3629out:
3627 return UNBLOCK_CONTINUE; 3630 return UNBLOCK_CONTINUE;
3628} 3631}
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5308841756be..2bf23fd333ed 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1290,7 +1290,7 @@ int ocfs2_getattr(struct vfsmount *mnt,
1290 struct kstat *stat) 1290 struct kstat *stat)
1291{ 1291{
1292 struct inode *inode = d_inode(dentry); 1292 struct inode *inode = d_inode(dentry);
1293 struct super_block *sb = d_inode(dentry)->i_sb; 1293 struct super_block *sb = dentry->d_sb;
1294 struct ocfs2_super *osb = sb->s_fs_info; 1294 struct ocfs2_super *osb = sb->s_fs_info;
1295 int err; 1295 int err;
1296 1296
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 7d3d979f57d9..72eef4cfe8a9 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7250,10 +7250,10 @@ leave:
7250 * 'security' attributes support 7250 * 'security' attributes support
7251 */ 7251 */
7252static int ocfs2_xattr_security_get(const struct xattr_handler *handler, 7252static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
7253 struct dentry *dentry, const char *name, 7253 struct dentry *unused, struct inode *inode,
7254 void *buffer, size_t size) 7254 const char *name, void *buffer, size_t size)
7255{ 7255{
7256 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, 7256 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY,
7257 name, buffer, size); 7257 name, buffer, size);
7258} 7258}
7259 7259
@@ -7321,10 +7321,10 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
7321 * 'trusted' attributes support 7321 * 'trusted' attributes support
7322 */ 7322 */
7323static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler, 7323static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
7324 struct dentry *dentry, const char *name, 7324 struct dentry *unused, struct inode *inode,
7325 void *buffer, size_t size) 7325 const char *name, void *buffer, size_t size)
7326{ 7326{
7327 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, 7327 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED,
7328 name, buffer, size); 7328 name, buffer, size);
7329} 7329}
7330 7330
@@ -7346,14 +7346,14 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
7346 * 'user' attributes support 7346 * 'user' attributes support
7347 */ 7347 */
7348static int ocfs2_xattr_user_get(const struct xattr_handler *handler, 7348static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
7349 struct dentry *dentry, const char *name, 7349 struct dentry *unusde, struct inode *inode,
7350 void *buffer, size_t size) 7350 const char *name, void *buffer, size_t size)
7351{ 7351{
7352 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7352 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
7353 7353
7354 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) 7354 if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
7355 return -EOPNOTSUPP; 7355 return -EOPNOTSUPP;
7356 return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name, 7356 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_USER, name,
7357 buffer, size); 7357 buffer, size);
7358} 7358}
7359 7359
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c
index 63a6280d8c3a..99c19545752c 100644
--- a/fs/orangefs/xattr.c
+++ b/fs/orangefs/xattr.c
@@ -463,12 +463,13 @@ static int orangefs_xattr_set_default(const struct xattr_handler *handler,
463} 463}
464 464
465static int orangefs_xattr_get_default(const struct xattr_handler *handler, 465static int orangefs_xattr_get_default(const struct xattr_handler *handler,
466 struct dentry *dentry, 466 struct dentry *unused,
467 struct inode *inode,
467 const char *name, 468 const char *name,
468 void *buffer, 469 void *buffer,
469 size_t size) 470 size_t size)
470{ 471{
471 return orangefs_inode_getxattr(dentry->d_inode, 472 return orangefs_inode_getxattr(inode,
472 ORANGEFS_XATTR_NAME_DEFAULT_PREFIX, 473 ORANGEFS_XATTR_NAME_DEFAULT_PREFIX,
473 name, 474 name,
474 buffer, 475 buffer,
@@ -492,12 +493,13 @@ static int orangefs_xattr_set_trusted(const struct xattr_handler *handler,
492} 493}
493 494
494static int orangefs_xattr_get_trusted(const struct xattr_handler *handler, 495static int orangefs_xattr_get_trusted(const struct xattr_handler *handler,
495 struct dentry *dentry, 496 struct dentry *unused,
497 struct inode *inode,
496 const char *name, 498 const char *name,
497 void *buffer, 499 void *buffer,
498 size_t size) 500 size_t size)
499{ 501{
500 return orangefs_inode_getxattr(dentry->d_inode, 502 return orangefs_inode_getxattr(inode,
501 ORANGEFS_XATTR_NAME_TRUSTED_PREFIX, 503 ORANGEFS_XATTR_NAME_TRUSTED_PREFIX,
502 name, 504 name,
503 buffer, 505 buffer,
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index a4ff5d0d7db9..c7b31a03dc9c 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -246,8 +246,8 @@ static bool ovl_need_xattr_filter(struct dentry *dentry,
246 return false; 246 return false;
247} 247}
248 248
249ssize_t ovl_getxattr(struct dentry *dentry, const char *name, 249ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode,
250 void *value, size_t size) 250 const char *name, void *value, size_t size)
251{ 251{
252 struct path realpath; 252 struct path realpath;
253 enum ovl_path_type type = ovl_path_real(dentry, &realpath); 253 enum ovl_path_type type = ovl_path_real(dentry, &realpath);
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 6a7090f4a441..99ec4b035237 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -173,8 +173,8 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr);
173int ovl_permission(struct inode *inode, int mask); 173int ovl_permission(struct inode *inode, int mask);
174int ovl_setxattr(struct dentry *dentry, const char *name, 174int ovl_setxattr(struct dentry *dentry, const char *name,
175 const void *value, size_t size, int flags); 175 const void *value, size_t size, int flags);
176ssize_t ovl_getxattr(struct dentry *dentry, const char *name, 176ssize_t ovl_getxattr(struct dentry *dentry, struct inode *inode,
177 void *value, size_t size); 177 const char *name, void *value, size_t size);
178ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); 178ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
179int ovl_removexattr(struct dentry *dentry, const char *name); 179int ovl_removexattr(struct dentry *dentry, const char *name);
180struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags); 180struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags);
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 5d972e6cd3fe..29c4d3250725 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -274,7 +274,7 @@ static bool ovl_is_opaquedir(struct dentry *dentry)
274 if (!S_ISDIR(inode->i_mode) || !inode->i_op->getxattr) 274 if (!S_ISDIR(inode->i_mode) || !inode->i_op->getxattr)
275 return false; 275 return false;
276 276
277 res = inode->i_op->getxattr(dentry, OVL_XATTR_OPAQUE, &val, 1); 277 res = inode->i_op->getxattr(dentry, inode, OVL_XATTR_OPAQUE, &val, 1);
278 if (res == 1 && val == 'y') 278 if (res == 1 && val == 'y')
279 return true; 279 return true;
280 280
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 711dd5170376..2c60f17e7d92 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -21,7 +21,7 @@
21#include <linux/export.h> 21#include <linux/export.h>
22#include <linux/user_namespace.h> 22#include <linux/user_namespace.h>
23 23
24struct posix_acl **acl_by_type(struct inode *inode, int type) 24static struct posix_acl **acl_by_type(struct inode *inode, int type)
25{ 25{
26 switch (type) { 26 switch (type) {
27 case ACL_TYPE_ACCESS: 27 case ACL_TYPE_ACCESS:
@@ -32,19 +32,22 @@ struct posix_acl **acl_by_type(struct inode *inode, int type)
32 BUG(); 32 BUG();
33 } 33 }
34} 34}
35EXPORT_SYMBOL(acl_by_type);
36 35
37struct posix_acl *get_cached_acl(struct inode *inode, int type) 36struct posix_acl *get_cached_acl(struct inode *inode, int type)
38{ 37{
39 struct posix_acl **p = acl_by_type(inode, type); 38 struct posix_acl **p = acl_by_type(inode, type);
40 struct posix_acl *acl = ACCESS_ONCE(*p); 39 struct posix_acl *acl;
41 if (acl) { 40
42 spin_lock(&inode->i_lock); 41 for (;;) {
43 acl = *p; 42 rcu_read_lock();
44 if (acl != ACL_NOT_CACHED) 43 acl = rcu_dereference(*p);
45 acl = posix_acl_dup(acl); 44 if (!acl || is_uncached_acl(acl) ||
46 spin_unlock(&inode->i_lock); 45 atomic_inc_not_zero(&acl->a_refcount))
46 break;
47 rcu_read_unlock();
48 cpu_relax();
47 } 49 }
50 rcu_read_unlock();
48 return acl; 51 return acl;
49} 52}
50EXPORT_SYMBOL(get_cached_acl); 53EXPORT_SYMBOL(get_cached_acl);
@@ -59,58 +62,72 @@ void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl)
59{ 62{
60 struct posix_acl **p = acl_by_type(inode, type); 63 struct posix_acl **p = acl_by_type(inode, type);
61 struct posix_acl *old; 64 struct posix_acl *old;
62 spin_lock(&inode->i_lock); 65
63 old = *p; 66 old = xchg(p, posix_acl_dup(acl));
64 rcu_assign_pointer(*p, posix_acl_dup(acl)); 67 if (!is_uncached_acl(old))
65 spin_unlock(&inode->i_lock);
66 if (old != ACL_NOT_CACHED)
67 posix_acl_release(old); 68 posix_acl_release(old);
68} 69}
69EXPORT_SYMBOL(set_cached_acl); 70EXPORT_SYMBOL(set_cached_acl);
70 71
71void forget_cached_acl(struct inode *inode, int type) 72static void __forget_cached_acl(struct posix_acl **p)
72{ 73{
73 struct posix_acl **p = acl_by_type(inode, type);
74 struct posix_acl *old; 74 struct posix_acl *old;
75 spin_lock(&inode->i_lock); 75
76 old = *p; 76 old = xchg(p, ACL_NOT_CACHED);
77 *p = ACL_NOT_CACHED; 77 if (!is_uncached_acl(old))
78 spin_unlock(&inode->i_lock);
79 if (old != ACL_NOT_CACHED)
80 posix_acl_release(old); 78 posix_acl_release(old);
81} 79}
80
81void forget_cached_acl(struct inode *inode, int type)
82{
83 __forget_cached_acl(acl_by_type(inode, type));
84}
82EXPORT_SYMBOL(forget_cached_acl); 85EXPORT_SYMBOL(forget_cached_acl);
83 86
84void forget_all_cached_acls(struct inode *inode) 87void forget_all_cached_acls(struct inode *inode)
85{ 88{
86 struct posix_acl *old_access, *old_default; 89 __forget_cached_acl(&inode->i_acl);
87 spin_lock(&inode->i_lock); 90 __forget_cached_acl(&inode->i_default_acl);
88 old_access = inode->i_acl;
89 old_default = inode->i_default_acl;
90 inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED;
91 spin_unlock(&inode->i_lock);
92 if (old_access != ACL_NOT_CACHED)
93 posix_acl_release(old_access);
94 if (old_default != ACL_NOT_CACHED)
95 posix_acl_release(old_default);
96} 91}
97EXPORT_SYMBOL(forget_all_cached_acls); 92EXPORT_SYMBOL(forget_all_cached_acls);
98 93
99struct posix_acl *get_acl(struct inode *inode, int type) 94struct posix_acl *get_acl(struct inode *inode, int type)
100{ 95{
96 void *sentinel;
97 struct posix_acl **p;
101 struct posix_acl *acl; 98 struct posix_acl *acl;
102 99
100 /*
101 * The sentinel is used to detect when another operation like
102 * set_cached_acl() or forget_cached_acl() races with get_acl().
103 * It is guaranteed that is_uncached_acl(sentinel) is true.
104 */
105
103 acl = get_cached_acl(inode, type); 106 acl = get_cached_acl(inode, type);
104 if (acl != ACL_NOT_CACHED) 107 if (!is_uncached_acl(acl))
105 return acl; 108 return acl;
106 109
107 if (!IS_POSIXACL(inode)) 110 if (!IS_POSIXACL(inode))
108 return NULL; 111 return NULL;
109 112
113 sentinel = uncached_acl_sentinel(current);
114 p = acl_by_type(inode, type);
115
110 /* 116 /*
111 * A filesystem can force a ACL callback by just never filling the 117 * If the ACL isn't being read yet, set our sentinel. Otherwise, the
112 * ACL cache. But normally you'd fill the cache either at inode 118 * current value of the ACL will not be ACL_NOT_CACHED and so our own
113 * instantiation time, or on the first ->get_acl call. 119 * sentinel will not be set; another task will update the cache. We
120 * could wait for that other task to complete its job, but it's easier
121 * to just call ->get_acl to fetch the ACL ourself. (This is going to
122 * be an unlikely race.)
123 */
124 if (cmpxchg(p, ACL_NOT_CACHED, sentinel) != ACL_NOT_CACHED)
125 /* fall through */ ;
126
127 /*
128 * Normally, the ACL returned by ->get_acl will be cached.
129 * A filesystem can prevent that by calling
130 * forget_cached_acl(inode, type) in ->get_acl.
114 * 131 *
115 * If the filesystem doesn't have a get_acl() function at all, we'll 132 * If the filesystem doesn't have a get_acl() function at all, we'll
116 * just create the negative cache entry. 133 * just create the negative cache entry.
@@ -119,7 +136,24 @@ struct posix_acl *get_acl(struct inode *inode, int type)
119 set_cached_acl(inode, type, NULL); 136 set_cached_acl(inode, type, NULL);
120 return NULL; 137 return NULL;
121 } 138 }
122 return inode->i_op->get_acl(inode, type); 139 acl = inode->i_op->get_acl(inode, type);
140
141 if (IS_ERR(acl)) {
142 /*
143 * Remove our sentinel so that we don't block future attempts
144 * to cache the ACL.
145 */
146 cmpxchg(p, sentinel, ACL_NOT_CACHED);
147 return acl;
148 }
149
150 /*
151 * Cache the result, but only if our sentinel is still in place.
152 */
153 posix_acl_dup(acl);
154 if (unlikely(cmpxchg(p, sentinel, acl) != sentinel))
155 posix_acl_release(acl);
156 return acl;
123} 157}
124EXPORT_SYMBOL(get_acl); 158EXPORT_SYMBOL(get_acl);
125 159
@@ -763,18 +797,18 @@ EXPORT_SYMBOL (posix_acl_to_xattr);
763 797
764static int 798static int
765posix_acl_xattr_get(const struct xattr_handler *handler, 799posix_acl_xattr_get(const struct xattr_handler *handler,
766 struct dentry *dentry, const char *name, 800 struct dentry *unused, struct inode *inode,
767 void *value, size_t size) 801 const char *name, void *value, size_t size)
768{ 802{
769 struct posix_acl *acl; 803 struct posix_acl *acl;
770 int error; 804 int error;
771 805
772 if (!IS_POSIXACL(d_backing_inode(dentry))) 806 if (!IS_POSIXACL(inode))
773 return -EOPNOTSUPP; 807 return -EOPNOTSUPP;
774 if (d_is_symlink(dentry)) 808 if (S_ISLNK(inode->i_mode))
775 return -EOPNOTSUPP; 809 return -EOPNOTSUPP;
776 810
777 acl = get_acl(d_backing_inode(dentry), handler->flags); 811 acl = get_acl(inode, handler->flags);
778 if (IS_ERR(acl)) 812 if (IS_ERR(acl))
779 return PTR_ERR(acl); 813 return PTR_ERR(acl);
780 if (acl == NULL) 814 if (acl == NULL)
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 389773711de4..90f815bdfa8a 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -260,10 +260,10 @@ const struct file_operations reiserfs_file_operations = {
260 260
261const struct inode_operations reiserfs_file_inode_operations = { 261const struct inode_operations reiserfs_file_inode_operations = {
262 .setattr = reiserfs_setattr, 262 .setattr = reiserfs_setattr,
263 .setxattr = reiserfs_setxattr, 263 .setxattr = generic_setxattr,
264 .getxattr = reiserfs_getxattr, 264 .getxattr = generic_getxattr,
265 .listxattr = reiserfs_listxattr, 265 .listxattr = reiserfs_listxattr,
266 .removexattr = reiserfs_removexattr, 266 .removexattr = generic_removexattr,
267 .permission = reiserfs_permission, 267 .permission = reiserfs_permission,
268 .get_acl = reiserfs_get_acl, 268 .get_acl = reiserfs_get_acl,
269 .set_acl = reiserfs_set_acl, 269 .set_acl = reiserfs_set_acl,
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 2a12d46d7fb4..8a36696d6df9 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1650,10 +1650,10 @@ const struct inode_operations reiserfs_dir_inode_operations = {
1650 .mknod = reiserfs_mknod, 1650 .mknod = reiserfs_mknod,
1651 .rename = reiserfs_rename, 1651 .rename = reiserfs_rename,
1652 .setattr = reiserfs_setattr, 1652 .setattr = reiserfs_setattr,
1653 .setxattr = reiserfs_setxattr, 1653 .setxattr = generic_setxattr,
1654 .getxattr = reiserfs_getxattr, 1654 .getxattr = generic_getxattr,
1655 .listxattr = reiserfs_listxattr, 1655 .listxattr = reiserfs_listxattr,
1656 .removexattr = reiserfs_removexattr, 1656 .removexattr = generic_removexattr,
1657 .permission = reiserfs_permission, 1657 .permission = reiserfs_permission,
1658 .get_acl = reiserfs_get_acl, 1658 .get_acl = reiserfs_get_acl,
1659 .set_acl = reiserfs_set_acl, 1659 .set_acl = reiserfs_set_acl,
@@ -1667,10 +1667,10 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
1667 .readlink = generic_readlink, 1667 .readlink = generic_readlink,
1668 .get_link = page_get_link, 1668 .get_link = page_get_link,
1669 .setattr = reiserfs_setattr, 1669 .setattr = reiserfs_setattr,
1670 .setxattr = reiserfs_setxattr, 1670 .setxattr = generic_setxattr,
1671 .getxattr = reiserfs_getxattr, 1671 .getxattr = generic_getxattr,
1672 .listxattr = reiserfs_listxattr, 1672 .listxattr = reiserfs_listxattr,
1673 .removexattr = reiserfs_removexattr, 1673 .removexattr = generic_removexattr,
1674 .permission = reiserfs_permission, 1674 .permission = reiserfs_permission,
1675}; 1675};
1676 1676
@@ -1679,10 +1679,10 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
1679 */ 1679 */
1680const struct inode_operations reiserfs_special_inode_operations = { 1680const struct inode_operations reiserfs_special_inode_operations = {
1681 .setattr = reiserfs_setattr, 1681 .setattr = reiserfs_setattr,
1682 .setxattr = reiserfs_setxattr, 1682 .setxattr = generic_setxattr,
1683 .getxattr = reiserfs_getxattr, 1683 .getxattr = generic_getxattr,
1684 .listxattr = reiserfs_listxattr, 1684 .listxattr = reiserfs_listxattr,
1685 .removexattr = reiserfs_removexattr, 1685 .removexattr = generic_removexattr,
1686 .permission = reiserfs_permission, 1686 .permission = reiserfs_permission,
1687 .get_acl = reiserfs_get_acl, 1687 .get_acl = reiserfs_get_acl,
1688 .set_acl = reiserfs_set_acl, 1688 .set_acl = reiserfs_set_acl,
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 28f5f8b11370..a33812ae9fad 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -764,60 +764,6 @@ find_xattr_handler_prefix(const struct xattr_handler **handlers,
764 return xah; 764 return xah;
765} 765}
766 766
767
768/*
769 * Inode operation getxattr()
770 */
771ssize_t
772reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
773 size_t size)
774{
775 const struct xattr_handler *handler;
776
777 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
778
779 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
780 return -EOPNOTSUPP;
781
782 return handler->get(handler, dentry, name, buffer, size);
783}
784
785/*
786 * Inode operation setxattr()
787 *
788 * d_inode(dentry)->i_mutex down
789 */
790int
791reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
792 size_t size, int flags)
793{
794 const struct xattr_handler *handler;
795
796 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
797
798 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
799 return -EOPNOTSUPP;
800
801 return handler->set(handler, dentry, name, value, size, flags);
802}
803
804/*
805 * Inode operation removexattr()
806 *
807 * d_inode(dentry)->i_mutex down
808 */
809int reiserfs_removexattr(struct dentry *dentry, const char *name)
810{
811 const struct xattr_handler *handler;
812
813 handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
814
815 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
816 return -EOPNOTSUPP;
817
818 return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
819}
820
821struct listxattr_buf { 767struct listxattr_buf {
822 struct dir_context ctx; 768 struct dir_context ctx;
823 size_t size; 769 size_t size;
diff --git a/fs/reiserfs/xattr.h b/fs/reiserfs/xattr.h
index 15dde6262c00..613ff5aef94e 100644
--- a/fs/reiserfs/xattr.h
+++ b/fs/reiserfs/xattr.h
@@ -2,6 +2,7 @@
2#include <linux/init.h> 2#include <linux/init.h>
3#include <linux/list.h> 3#include <linux/list.h>
4#include <linux/rwsem.h> 4#include <linux/rwsem.h>
5#include <linux/xattr.h>
5 6
6struct inode; 7struct inode;
7struct dentry; 8struct dentry;
@@ -18,12 +19,7 @@ int reiserfs_permission(struct inode *inode, int mask);
18 19
19#ifdef CONFIG_REISERFS_FS_XATTR 20#ifdef CONFIG_REISERFS_FS_XATTR
20#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 21#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
21ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
22 void *buffer, size_t size);
23int reiserfs_setxattr(struct dentry *dentry, const char *name,
24 const void *value, size_t size, int flags);
25ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 22ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
26int reiserfs_removexattr(struct dentry *dentry, const char *name);
27 23
28int reiserfs_xattr_get(struct inode *, const char *, void *, size_t); 24int reiserfs_xattr_get(struct inode *, const char *, void *, size_t);
29int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); 25int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
@@ -92,10 +88,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
92 88
93#else 89#else
94 90
95#define reiserfs_getxattr NULL
96#define reiserfs_setxattr NULL
97#define reiserfs_listxattr NULL 91#define reiserfs_listxattr NULL
98#define reiserfs_removexattr NULL
99 92
100static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 93static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
101{ 94{
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 558a16beaacb..dbed42f755e0 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -197,10 +197,8 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
197 197
198 size = reiserfs_xattr_get(inode, name, NULL, 0); 198 size = reiserfs_xattr_get(inode, name, NULL, 0);
199 if (size < 0) { 199 if (size < 0) {
200 if (size == -ENODATA || size == -ENOSYS) { 200 if (size == -ENODATA || size == -ENOSYS)
201 set_cached_acl(inode, type, NULL);
202 return NULL; 201 return NULL;
203 }
204 return ERR_PTR(size); 202 return ERR_PTR(size);
205 } 203 }
206 204
@@ -220,8 +218,6 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
220 } else { 218 } else {
221 acl = reiserfs_posix_acl_from_disk(value, retval); 219 acl = reiserfs_posix_acl_from_disk(value, retval);
222 } 220 }
223 if (!IS_ERR(acl))
224 set_cached_acl(inode, type, acl);
225 221
226 kfree(value); 222 kfree(value);
227 return acl; 223 return acl;
@@ -370,7 +366,7 @@ int reiserfs_cache_default_acl(struct inode *inode)
370 if (IS_PRIVATE(inode)) 366 if (IS_PRIVATE(inode))
371 return 0; 367 return 0;
372 368
373 acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT); 369 acl = get_acl(inode, ACL_TYPE_DEFAULT);
374 370
375 if (acl && !IS_ERR(acl)) { 371 if (acl && !IS_ERR(acl)) {
376 int size = reiserfs_acl_size(acl->a_count); 372 int size = reiserfs_acl_size(acl->a_count);
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index ab0217d32039..86aeb9dd805a 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -9,29 +9,26 @@
9#include <linux/uaccess.h> 9#include <linux/uaccess.h>
10 10
11static int 11static int
12security_get(const struct xattr_handler *handler, struct dentry *dentry, 12security_get(const struct xattr_handler *handler, struct dentry *unused,
13 const char *name, void *buffer, size_t size) 13 struct inode *inode, const char *name, void *buffer, size_t size)
14{ 14{
15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 15 if (IS_PRIVATE(inode))
16 return -EINVAL;
17
18 if (IS_PRIVATE(d_inode(dentry)))
19 return -EPERM; 16 return -EPERM;
20 17
21 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); 18 return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
19 buffer, size);
22} 20}
23 21
24static int 22static int
25security_set(const struct xattr_handler *handler, struct dentry *dentry, 23security_set(const struct xattr_handler *handler, struct dentry *dentry,
26 const char *name, const void *buffer, size_t size, int flags) 24 const char *name, const void *buffer, size_t size, int flags)
27{ 25{
28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
29 return -EINVAL;
30
31 if (IS_PRIVATE(d_inode(dentry))) 26 if (IS_PRIVATE(d_inode(dentry)))
32 return -EPERM; 27 return -EPERM;
33 28
34 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 29 return reiserfs_xattr_set(d_inode(dentry),
30 xattr_full_name(handler, name),
31 buffer, size, flags);
35} 32}
36 33
37static bool security_list(struct dentry *dentry) 34static bool security_list(struct dentry *dentry)
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
index 64b67aa643a9..31837f031f59 100644
--- a/fs/reiserfs/xattr_trusted.c
+++ b/fs/reiserfs/xattr_trusted.c
@@ -8,29 +8,26 @@
8#include <linux/uaccess.h> 8#include <linux/uaccess.h>
9 9
10static int 10static int
11trusted_get(const struct xattr_handler *handler, struct dentry *dentry, 11trusted_get(const struct xattr_handler *handler, struct dentry *unused,
12 const char *name, void *buffer, size_t size) 12 struct inode *inode, const char *name, void *buffer, size_t size)
13{ 13{
14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 14 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
15 return -EINVAL;
16
17 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
18 return -EPERM; 15 return -EPERM;
19 16
20 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); 17 return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
18 buffer, size);
21} 19}
22 20
23static int 21static int
24trusted_set(const struct xattr_handler *handler, struct dentry *dentry, 22trusted_set(const struct xattr_handler *handler, struct dentry *dentry,
25 const char *name, const void *buffer, size_t size, int flags) 23 const char *name, const void *buffer, size_t size, int flags)
26{ 24{
27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
28 return -EINVAL;
29
30 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) 25 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
31 return -EPERM; 26 return -EPERM;
32 27
33 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 28 return reiserfs_xattr_set(d_inode(dentry),
29 xattr_full_name(handler, name),
30 buffer, size, flags);
34} 31}
35 32
36static bool trusted_list(struct dentry *dentry) 33static bool trusted_list(struct dentry *dentry)
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index 12e6306f562a..f7c39731684b 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -7,27 +7,24 @@
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8 8
9static int 9static int
10user_get(const struct xattr_handler *handler, struct dentry *dentry, 10user_get(const struct xattr_handler *handler, struct dentry *unused,
11 const char *name, void *buffer, size_t size) 11 struct inode *inode, const char *name, void *buffer, size_t size)
12{ 12{
13 13 if (!reiserfs_xattrs_user(inode->i_sb))
14 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
15 return -EINVAL;
16 if (!reiserfs_xattrs_user(dentry->d_sb))
17 return -EOPNOTSUPP; 14 return -EOPNOTSUPP;
18 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size); 15 return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
16 buffer, size);
19} 17}
20 18
21static int 19static int
22user_set(const struct xattr_handler *handler, struct dentry *dentry, 20user_set(const struct xattr_handler *handler, struct dentry *dentry,
23 const char *name, const void *buffer, size_t size, int flags) 21 const char *name, const void *buffer, size_t size, int flags)
24{ 22{
25 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
26 return -EINVAL;
27
28 if (!reiserfs_xattrs_user(dentry->d_sb)) 23 if (!reiserfs_xattrs_user(dentry->d_sb))
29 return -EOPNOTSUPP; 24 return -EOPNOTSUPP;
30 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 25 return reiserfs_xattr_set(d_inode(dentry),
26 xattr_full_name(handler, name),
27 buffer, size, flags);
31} 28}
32 29
33static bool user_list(struct dentry *dentry) 30static bool user_list(struct dentry *dentry)
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index 1e9de96288d8..1548b3784548 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -214,10 +214,12 @@ failed:
214 214
215 215
216static int squashfs_xattr_handler_get(const struct xattr_handler *handler, 216static int squashfs_xattr_handler_get(const struct xattr_handler *handler,
217 struct dentry *d, const char *name, 217 struct dentry *unused,
218 struct inode *inode,
219 const char *name,
218 void *buffer, size_t size) 220 void *buffer, size_t size)
219{ 221{
220 return squashfs_xattr_get(d_inode(d), handler->flags, name, 222 return squashfs_xattr_get(inode, handler->flags, name,
221 buffer, size); 223 buffer, size);
222} 224}
223 225
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 4cd7e569cd00..12e79e60c176 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1734,8 +1734,8 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1734/* xattr.c */ 1734/* xattr.c */
1735int ubifs_setxattr(struct dentry *dentry, const char *name, 1735int ubifs_setxattr(struct dentry *dentry, const char *name,
1736 const void *value, size_t size, int flags); 1736 const void *value, size_t size, int flags);
1737ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, 1737ssize_t ubifs_getxattr(struct dentry *dentry, struct inode *host,
1738 size_t size); 1738 const char *name, void *buf, size_t size);
1739ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); 1739ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
1740int ubifs_removexattr(struct dentry *dentry, const char *name); 1740int ubifs_removexattr(struct dentry *dentry, const char *name);
1741int ubifs_init_security(struct inode *dentry, struct inode *inode, 1741int ubifs_init_security(struct inode *dentry, struct inode *inode,
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index b043e044121d..413d650c9476 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -372,10 +372,10 @@ int ubifs_setxattr(struct dentry *dentry, const char *name,
372 return setxattr(d_inode(dentry), name, value, size, flags); 372 return setxattr(d_inode(dentry), name, value, size, flags);
373} 373}
374 374
375ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, 375ssize_t ubifs_getxattr(struct dentry *dentry, struct inode *host,
376 size_t size) 376 const char *name, void *buf, size_t size)
377{ 377{
378 struct inode *inode, *host = d_inode(dentry); 378 struct inode *inode;
379 struct ubifs_info *c = host->i_sb->s_fs_info; 379 struct ubifs_info *c = host->i_sb->s_fs_info;
380 struct qstr nm = QSTR_INIT(name, strlen(name)); 380 struct qstr nm = QSTR_INIT(name, strlen(name));
381 struct ubifs_inode *ui; 381 struct ubifs_inode *ui;
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index a2ba11eca995..c3e5c9679371 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -1250,7 +1250,7 @@ static struct dentry *udf_get_parent(struct dentry *child)
1250 brelse(fibh.sbh); 1250 brelse(fibh.sbh);
1251 1251
1252 tloc = lelb_to_cpu(cfi.icb.extLocation); 1252 tloc = lelb_to_cpu(cfi.icb.extLocation);
1253 inode = udf_iget(d_inode(child)->i_sb, &tloc); 1253 inode = udf_iget(child->d_sb, &tloc);
1254 if (IS_ERR(inode)) 1254 if (IS_ERR(inode))
1255 return ERR_CAST(inode); 1255 return ERR_CAST(inode);
1256 1256
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 442fd52ebffe..f04ab232d08d 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -132,7 +132,7 @@ static struct dentry *ufs_get_parent(struct dentry *child)
132 ino = ufs_inode_by_name(d_inode(child), &dot_dot); 132 ino = ufs_inode_by_name(d_inode(child), &dot_dot);
133 if (!ino) 133 if (!ino)
134 return ERR_PTR(-ENOENT); 134 return ERR_PTR(-ENOENT);
135 return d_obtain_alias(ufs_iget(d_inode(child)->i_sb, ino)); 135 return d_obtain_alias(ufs_iget(child->d_sb, ino));
136} 136}
137 137
138static const struct export_operations ufs_export_ops = { 138static const struct export_operations ufs_export_ops = {
diff --git a/fs/xattr.c b/fs/xattr.c
index 4861322e28e8..b11945e15fde 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -192,7 +192,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
192 if (!inode->i_op->getxattr) 192 if (!inode->i_op->getxattr)
193 return -EOPNOTSUPP; 193 return -EOPNOTSUPP;
194 194
195 error = inode->i_op->getxattr(dentry, name, NULL, 0); 195 error = inode->i_op->getxattr(dentry, inode, name, NULL, 0);
196 if (error < 0) 196 if (error < 0)
197 return error; 197 return error;
198 198
@@ -203,7 +203,7 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value,
203 memset(value, 0, error + 1); 203 memset(value, 0, error + 1);
204 } 204 }
205 205
206 error = inode->i_op->getxattr(dentry, name, value, error); 206 error = inode->i_op->getxattr(dentry, inode, name, value, error);
207 *xattr_value = value; 207 *xattr_value = value;
208 return error; 208 return error;
209} 209}
@@ -236,7 +236,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
236 } 236 }
237nolsm: 237nolsm:
238 if (inode->i_op->getxattr) 238 if (inode->i_op->getxattr)
239 error = inode->i_op->getxattr(dentry, name, value, size); 239 error = inode->i_op->getxattr(dentry, inode, name, value, size);
240 else 240 else
241 error = -EOPNOTSUPP; 241 error = -EOPNOTSUPP;
242 242
@@ -691,14 +691,16 @@ xattr_resolve_name(const struct xattr_handler **handlers, const char **name)
691 * Find the handler for the prefix and dispatch its get() operation. 691 * Find the handler for the prefix and dispatch its get() operation.
692 */ 692 */
693ssize_t 693ssize_t
694generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size) 694generic_getxattr(struct dentry *dentry, struct inode *inode,
695 const char *name, void *buffer, size_t size)
695{ 696{
696 const struct xattr_handler *handler; 697 const struct xattr_handler *handler;
697 698
698 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 699 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
699 if (IS_ERR(handler)) 700 if (IS_ERR(handler))
700 return PTR_ERR(handler); 701 return PTR_ERR(handler);
701 return handler->get(handler, dentry, name, buffer, size); 702 return handler->get(handler, dentry, inode,
703 name, buffer, size);
702} 704}
703 705
704/* 706/*
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 2d5df1f23bbc..b6e527b8eccb 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -158,22 +158,14 @@ xfs_get_acl(struct inode *inode, int type)
158 if (error) { 158 if (error) {
159 /* 159 /*
160 * If the attribute doesn't exist make sure we have a negative 160 * If the attribute doesn't exist make sure we have a negative
161 * cache entry, for any other error assume it is transient and 161 * cache entry, for any other error assume it is transient.
162 * leave the cache entry as ACL_NOT_CACHED.
163 */ 162 */
164 if (error == -ENOATTR) 163 if (error != -ENOATTR)
165 goto out_update_cache; 164 acl = ERR_PTR(error);
166 acl = ERR_PTR(error); 165 } else {
167 goto out; 166 acl = xfs_acl_from_disk(xfs_acl, len,
167 XFS_ACL_MAX_ENTRIES(ip->i_mount));
168 } 168 }
169
170 acl = xfs_acl_from_disk(xfs_acl, len, XFS_ACL_MAX_ENTRIES(ip->i_mount));
171 if (IS_ERR(acl))
172 goto out;
173
174out_update_cache:
175 set_cached_acl(inode, type, acl);
176out:
177 kmem_free(xfs_acl); 169 kmem_free(xfs_acl);
178 return acl; 170 return acl;
179} 171}
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 110f1d7d86b0..d111f691f313 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -32,11 +32,11 @@
32 32
33 33
34static int 34static int
35xfs_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, 35xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
36 const char *name, void *value, size_t size) 36 struct inode *inode, const char *name, void *value, size_t size)
37{ 37{
38 int xflags = handler->flags; 38 int xflags = handler->flags;
39 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 39 struct xfs_inode *ip = XFS_I(inode);
40 int error, asize = size; 40 int error, asize = size;
41 41
42 /* Convert Linux syscall to XFS internal ATTR flags */ 42 /* Convert Linux syscall to XFS internal ATTR flags */