[PATCH 3.18.y 1/5] xattr_handler: pass dentry and inode as separate arguments of ->get()

From: Seung-Woo Kim
Date: Thu Aug 09 2018 - 05:53:55 EST


From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

commit b296821a7c42fa58baa17513b2b7b30ae66f3336 upstream.

... and do not assume they are already attached to each other

Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

[sw0312.kim: backport to 3.18 including ext3]
Signed-off-by: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx>
---
fs/9p/acl.c | 7 ++++---
fs/9p/xattr_security.c | 5 +++--
fs/9p/xattr_trusted.c | 5 +++--
fs/9p/xattr_user.c | 5 +++--
fs/ext2/xattr_security.c | 6 +++---
fs/ext2/xattr_trusted.c | 6 +++---
fs/ext2/xattr_user.c | 8 ++++----
fs/ext3/xattr_security.c | 6 +++---
fs/ext3/xattr_trusted.c | 6 +++---
fs/ext3/xattr_user.c | 8 ++++----
fs/ext4/xattr_security.c | 6 +++---
fs/ext4/xattr_trusted.c | 6 +++---
fs/ext4/xattr_user.c | 8 ++++----
fs/f2fs/xattr.c | 15 +++++++--------
fs/gfs2/xattr.c | 6 +++---
fs/hfsplus/xattr.c | 7 ++++---
fs/hfsplus/xattr.h | 10 +++++-----
fs/hfsplus/xattr_security.c | 7 ++++---
fs/hfsplus/xattr_trusted.c | 7 ++++---
fs/hfsplus/xattr_user.c | 7 ++++---
fs/jffs2/security.c | 7 ++++---
fs/jffs2/xattr_trusted.c | 7 ++++---
fs/jffs2/xattr_user.c | 7 ++++---
fs/nfs/nfs4proc.c | 14 ++++++++------
fs/ocfs2/xattr.c | 23 +++++++++++++----------
fs/posix_acl.c | 10 +++++-----
fs/reiserfs/xattr.c | 3 ++-
fs/reiserfs/xattr_security.c | 8 ++++----
fs/reiserfs/xattr_trusted.c | 8 ++++----
fs/reiserfs/xattr_user.c | 8 ++++----
fs/squashfs/xattr.c | 22 +++++++++++++---------
fs/xattr.c | 3 ++-
fs/xfs/xfs_xattr.c | 4 ++--
include/linux/xattr.h | 4 ++--
34 files changed, 145 insertions(+), 124 deletions(-)

diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index cc67477..938e1a4 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -230,8 +230,9 @@ static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,
return v9fs_xattr_get(dentry, full_name, buffer, size);
}

-static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int v9fs_xattr_get_acl(struct dentry *dentry, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
struct v9fs_session_info *v9ses;
struct posix_acl *acl;
@@ -247,7 +248,7 @@ static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
return v9fs_remote_get_acl(dentry, name, buffer, size, type);

- acl = v9fs_get_cached_acl(dentry->d_inode, type);
+ acl = v9fs_get_cached_acl(inode, type);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
diff --git a/fs/9p/xattr_security.c b/fs/9p/xattr_security.c
index cb247a1..df692f9 100644
--- a/fs/9p/xattr_security.c
+++ b/fs/9p/xattr_security.c
@@ -19,8 +19,9 @@
#include <linux/slab.h>
#include "xattr.h"

-static int v9fs_xattr_security_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int v9fs_xattr_security_get(struct dentry *dentry, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
int retval;
char *full_name;
diff --git a/fs/9p/xattr_trusted.c b/fs/9p/xattr_trusted.c
index e30d33b..acfadcf 100644
--- a/fs/9p/xattr_trusted.c
+++ b/fs/9p/xattr_trusted.c
@@ -19,8 +19,9 @@
#include <linux/slab.h>
#include "xattr.h"

-static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int v9fs_xattr_trusted_get(struct dentry *dentry, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
int retval;
char *full_name;
diff --git a/fs/9p/xattr_user.c b/fs/9p/xattr_user.c
index d0b701b..9b37675 100644
--- a/fs/9p/xattr_user.c
+++ b/fs/9p/xattr_user.c
@@ -19,8 +19,9 @@
#include <linux/slab.h>
#include "xattr.h"

-static int v9fs_xattr_user_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int v9fs_xattr_user_get(struct dentry *dentry, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
int retval;
char *full_name;
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c
index c0ebc4d..1d53da4 100644
--- a/fs/ext2/xattr_security.c
+++ b/fs/ext2/xattr_security.c
@@ -23,12 +23,12 @@ ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext2_xattr_security_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext2_xattr_security_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_SECURITY, name,
+ return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name,
buffer, size);
}

diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c
index 7e19257..dd05f14 100644
--- a/fs/ext2/xattr_trusted.c
+++ b/fs/ext2/xattr_trusted.c
@@ -27,12 +27,12 @@ ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext2_xattr_trusted_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_TRUSTED, name,
+ return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
buffer, size);
}

diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index f470e44..b3289d5 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -29,14 +29,14 @@ ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext2_xattr_user_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext2_xattr_user_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
- return ext2_xattr_get(dentry->d_inode, EXT2_XATTR_INDEX_USER,
+ return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
name, buffer, size);
}

diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c
index 722c2bf..3e60abc 100644
--- a/fs/ext3/xattr_security.c
+++ b/fs/ext3/xattr_security.c
@@ -24,12 +24,12 @@ ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext3_xattr_security_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext3_xattr_security_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_SECURITY,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY,
name, buffer, size);
}

diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c
index d75727c..9fe035b 100644
--- a/fs/ext3/xattr_trusted.c
+++ b/fs/ext3/xattr_trusted.c
@@ -27,12 +27,12 @@ ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext3_xattr_trusted_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext3_xattr_trusted_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_TRUSTED,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
name, buffer, size);
}

diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c
index 5612af3..8856f51 100644
--- a/fs/ext3/xattr_user.c
+++ b/fs/ext3/xattr_user.c
@@ -27,14 +27,14 @@ ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer,
- size_t size, int type)
+ext3_xattr_user_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
- return ext3_xattr_get(dentry->d_inode, EXT3_XATTR_INDEX_USER,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER,
name, buffer, size);
}

diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index d2a2006..7704e94 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -28,12 +28,12 @@ ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext4_xattr_security_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext4_xattr_security_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_SECURITY,
+ return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY,
name, buffer, size);
}

diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index 95f1f4a..7bf8df2 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -31,12 +31,12 @@ ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
- size_t size, int type)
+ext4_xattr_trusted_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_TRUSTED,
+ return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED,
name, buffer, size);
}

diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index 0edb7611..afad2827 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -30,14 +30,14 @@ ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}

static int
-ext4_xattr_user_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+ext4_xattr_user_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
- return ext4_xattr_get(dentry->d_inode, EXT4_XATTR_INDEX_USER,
+ return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
name, buffer, size);
}

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index deca872..a6e15c5 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -62,10 +62,11 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
return total_len;
}

-static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int f2fs_xattr_generic_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
- struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
+ struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);

switch (type) {
case F2FS_XATTR_INDEX_USER:
@@ -83,7 +84,7 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
}
if (strcmp(name, "") == 0)
return -EINVAL;
- return f2fs_getxattr(dentry->d_inode, type, name, buffer, size);
+ return f2fs_getxattr(inode, type, name, buffer, size);
}

static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
@@ -127,11 +128,9 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
return size;
}

-static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int f2fs_xattr_advise_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
- struct inode *inode = dentry->d_inode;
-
if (strcmp(name, "") != 0)
return -EINVAL;

diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 0b81f78..0c15e9f 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -583,10 +583,10 @@ out:
*
* Returns: actual size of data on success, -errno on error
*/
-static int gfs2_xattr_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int gfs2_xattr_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size, int type)
{
- struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
+ struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_ea_location el;
int error;

diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index ff10f3d..1377437 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -803,8 +803,9 @@ end_removexattr:
return err;
}

-static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int hfsplus_osx_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (!strcmp(name, ""))
return -EINVAL;
@@ -822,7 +823,7 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
* creates), so we pass the name through unmodified (after
* ensuring it doesn't conflict with another namespace).
*/
- return hfsplus_getxattr(dentry, name, buffer, size);
+ return hfsplus_getxattr(inode, name, buffer, size);
}

static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h
index 288530c..ba9d80d7 100644
--- a/fs/hfsplus/xattr.h
+++ b/fs/hfsplus/xattr.h
@@ -30,12 +30,12 @@ static inline int hfsplus_setxattr(struct dentry *dentry, const char *name,
ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
void *value, size_t size);

-static inline ssize_t hfsplus_getxattr(struct dentry *dentry,
- const char *name,
- void *value,
- size_t size)
+static inline ssize_t hfsplus_getxattr(struct inode *inode,
+ const char *name,
+ void *value,
+ size_t size)
{
- return __hfsplus_getxattr(dentry->d_inode, name, value, size);
+ return __hfsplus_getxattr(inode, name, value, size);
}

ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c
index 6ec5e10..77d7f29 100644
--- a/fs/hfsplus/xattr_security.c
+++ b/fs/hfsplus/xattr_security.c
@@ -13,8 +13,9 @@
#include "xattr.h"
#include "acl.h"

-static int hfsplus_security_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int hfsplus_security_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer,
+ size_t size, int type)
{
char *xattr_name;
int res;
@@ -29,7 +30,7 @@ static int hfsplus_security_getxattr(struct dentry *dentry, const char *name,
strcpy(xattr_name, XATTR_SECURITY_PREFIX);
strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name);

- res = hfsplus_getxattr(dentry, xattr_name, buffer, size);
+ res = hfsplus_getxattr(inode, xattr_name, buffer, size);
kfree(xattr_name);
return res;
}
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c
index 3c5f27e..5c9e7a0 100644
--- a/fs/hfsplus/xattr_trusted.c
+++ b/fs/hfsplus/xattr_trusted.c
@@ -11,8 +11,9 @@
#include "hfsplus_fs.h"
#include "xattr.h"

-static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int hfsplus_trusted_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
char *xattr_name;
int res;
@@ -27,7 +28,7 @@ static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name,
strcpy(xattr_name, XATTR_TRUSTED_PREFIX);
strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name);

- res = hfsplus_getxattr(dentry, xattr_name, buffer, size);
+ res = hfsplus_getxattr(inode, xattr_name, buffer, size);
kfree(xattr_name);
return res;
}
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c
index 2b625a5..c7c424c 100644
--- a/fs/hfsplus/xattr_user.c
+++ b/fs/hfsplus/xattr_user.c
@@ -11,8 +11,9 @@
#include "hfsplus_fs.h"
#include "xattr.h"

-static int hfsplus_user_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int hfsplus_user_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
char *xattr_name;
int res;
@@ -27,7 +28,7 @@ static int hfsplus_user_getxattr(struct dentry *dentry, const char *name,
strcpy(xattr_name, XATTR_USER_PREFIX);
strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name);

- res = hfsplus_getxattr(dentry, xattr_name, buffer, size);
+ res = hfsplus_getxattr(inode, xattr_name, buffer, size);
kfree(xattr_name);
return res;
}
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index aca97f3..77a9db6 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -48,13 +48,14 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
}

/* ---- XATTR Handler for "security.*" ----------------- */
-static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int jffs2_security_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (!strcmp(name, ""))
return -EINVAL;

- return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_SECURITY,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY,
name, buffer, size);
}

diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index 1c86819..7b2fe19 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -16,12 +16,13 @@
#include <linux/mtd/mtd.h>
#include "nodelist.h"

-static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int jffs2_trusted_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_TRUSTED,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size);
}

diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c
index 916b5c9..0d8b125 100644
--- a/fs/jffs2/xattr_user.c
+++ b/fs/jffs2/xattr_user.c
@@ -16,12 +16,13 @@
#include <linux/mtd/mtd.h>
#include "nodelist.h"

-static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int jffs2_user_getxattr(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_getxattr(dentry->d_inode, JFFS2_XPREFIX_USER,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER,
name, buffer, size);
}

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 321044c..3e0df4a1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6047,13 +6047,14 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
return nfs4_proc_set_acl(dentry->d_inode, buf, buflen);
}

-static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
- void *buf, size_t buflen, int type)
+static int nfs4_xattr_get_nfs4_acl(struct dentry *unused, struct inode *inode,
+ const char *key, void *buf, size_t buflen,
+ int type)
{
if (strcmp(key, "") != 0)
return -EINVAL;

- return nfs4_proc_get_acl(dentry->d_inode, buf, buflen);
+ return nfs4_proc_get_acl(inode, buf, buflen);
}

static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
@@ -6086,11 +6087,12 @@ static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key,
return -EOPNOTSUPP;
}

-static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key,
- void *buf, size_t buflen, int type)
+static int nfs4_xattr_get_nfs4_label(struct dentry *unused, struct inode *inode,
+ const char *key, void *buf, size_t buflen,
+ int type)
{
if (security_ismaclabel(key))
- return nfs4_get_security_label(dentry->d_inode, buf, buflen);
+ return nfs4_get_security_label(inode, buf, buflen);
return -EOPNOTSUPP;
}

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 068e8af..8f42eaa 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7252,12 +7252,13 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
return total_len;
}

-static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int ocfs2_xattr_security_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_SECURITY,
+ return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY,
name, buffer, size);
}

@@ -7342,12 +7343,13 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
return total_len;
}

-static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int ocfs2_xattr_trusted_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_TRUSTED,
+ return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED,
name, buffer, size);
}

@@ -7390,16 +7392,17 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
return total_len;
}

-static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
- void *buffer, size_t size, int type)
+static int ocfs2_xattr_user_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
- struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
+ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);

if (strcmp(name, "") == 0)
return -EINVAL;
if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
return -EOPNOTSUPP;
- return ocfs2_xattr_get(dentry->d_inode, OCFS2_XATTR_INDEX_USER, name,
+ return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_USER, name,
buffer, size);
}

diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 38c9193..a9d6c01 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -795,18 +795,18 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
EXPORT_SYMBOL (posix_acl_to_xattr);

static int
-posix_acl_xattr_get(struct dentry *dentry, const char *name,
- void *value, size_t size, int type)
+posix_acl_xattr_get(struct dentry *unused, struct inode *inode,
+ const char *name, void *value, size_t size, int type)
{
struct posix_acl *acl;
int error;

- if (!IS_POSIXACL(dentry->d_inode))
+ if (!IS_POSIXACL(inode))
return -EOPNOTSUPP;
- if (S_ISLNK(dentry->d_inode->i_mode))
+ if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;

- acl = get_acl(dentry->d_inode, type);
+ acl = get_acl(inode, type);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 7c36898..9998770 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -777,7 +777,8 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
if (!handler || get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1)
return -EOPNOTSUPP;

- return handler->get(dentry, name, buffer, size, handler->flags);
+ return handler->get(dentry, dentry->d_inode, name, buffer, size,
+ handler->flags);
}

/*
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index e7f8939..dad61a9 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -9,16 +9,16 @@
#include <linux/uaccess.h>

static int
-security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
- int handler_flags)
+security_get(struct dentry *unused, struct inode *inode, const char *name,
+ void *buffer, size_t size, int handler_flags)
{
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;

- if (IS_PRIVATE(dentry->d_inode))
+ if (IS_PRIVATE(inode))
return -EPERM;

- return reiserfs_xattr_get(dentry->d_inode, name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}

static int
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
index 5eeb0c4..9e3cf4a 100644
--- a/fs/reiserfs/xattr_trusted.c
+++ b/fs/reiserfs/xattr_trusted.c
@@ -8,16 +8,16 @@
#include <linux/uaccess.h>

static int
-trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
- int handler_flags)
+trusted_get(struct dentry *unused, struct inode *inode, const char *name,
+ void *buffer, size_t size, int handler_flags)
{
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;

- if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(dentry->d_inode))
+ if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;

- return reiserfs_xattr_get(dentry->d_inode, name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}

static int
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index e50eab0..8c0d2ef 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -7,15 +7,15 @@
#include <linux/uaccess.h>

static int
-user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
- int handler_flags)
+user_get(struct dentry *unused, struct inode *inode, const char *name,
+ void *buffer, size_t size, int handler_flags)
{

if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL;
- if (!reiserfs_xattrs_user(dentry->d_sb))
+ if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP;
- return reiserfs_xattr_get(dentry->d_inode, name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}

static int
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index 92fcde7..090963e 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -223,13 +223,15 @@ static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size,
return XATTR_USER_PREFIX_LEN;
}

-static int squashfs_user_get(struct dentry *d, const char *name, void *buffer,
- size_t size, int type)
+static int squashfs_user_get(struct dentry *unused,
+ struct inode *inode,
+ const char *name,
+ void *buffer, size_t size, int type)
{
if (name[0] == '\0')
return -EINVAL;

- return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_USER, name,
+ return squashfs_xattr_get(inode, SQUASHFS_XATTR_USER, name,
buffer, size);
}

@@ -253,13 +255,14 @@ static size_t squashfs_trusted_list(struct dentry *d, char *list,
return XATTR_TRUSTED_PREFIX_LEN;
}

-static int squashfs_trusted_get(struct dentry *d, const char *name,
- void *buffer, size_t size, int type)
+static int squashfs_trusted_get(struct dentry *d, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (name[0] == '\0')
return -EINVAL;

- return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_TRUSTED, name,
+ return squashfs_xattr_get(inode, SQUASHFS_XATTR_TRUSTED, name,
buffer, size);
}

@@ -280,13 +283,14 @@ static size_t squashfs_security_list(struct dentry *d, char *list,
return XATTR_SECURITY_PREFIX_LEN;
}

-static int squashfs_security_get(struct dentry *d, const char *name,
- void *buffer, size_t size, int type)
+static int squashfs_security_get(struct dentry *d, struct inode *inode,
+ const char *name, void *buffer, size_t size,
+ int type)
{
if (name[0] == '\0')
return -EINVAL;

- return squashfs_xattr_get(d->d_inode, SQUASHFS_XATTR_SECURITY, name,
+ return squashfs_xattr_get(inode, SQUASHFS_XATTR_SECURITY, name,
buffer, size);
}

diff --git a/fs/xattr.c b/fs/xattr.c
index d536edb..70a5962 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -724,7 +724,8 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
- return handler->get(dentry, name, buffer, size, handler->flags);
+ return handler->get(dentry, dentry->d_inode, name, buffer, size,
+ handler->flags);
}

/*
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 93455b9..bd4a6ee 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -34,10 +34,10 @@


static int
-xfs_xattr_get(struct dentry *dentry, const char *name,
+xfs_xattr_get(struct dentry *unused, struct inode *inode, const char *name,
void *value, size_t size, int xflags)
{
- struct xfs_inode *ip = XFS_I(dentry->d_inode);
+ struct xfs_inode *ip = XFS_I(inode);
int error, asize = size;

if (strcmp(name, "") == 0)
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index 91b0a68..1088878 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -24,8 +24,8 @@ struct xattr_handler {
int flags; /* fs private flags passed back to the handlers */
size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
const char *name, size_t name_len, int handler_flags);
- int (*get)(struct dentry *dentry, const char *name, void *buffer,
- size_t size, int handler_flags);
+ int (*get)(struct dentry *dentry, struct inode *inode, const char *name,
+ void *buffer, size_t size, int handler_flags);
int (*set)(struct dentry *dentry, const char *name, const void *buffer,
size_t size, int flags, int handler_flags);
};
--
1.7.4.1