Skip to content

Commit

Permalink
Merge getxattr prototype change into work.lookups
Browse files Browse the repository at this point in the history
The rest of work.xattr stuff isn't needed for this branch
  • Loading branch information
Al Viro committed May 2, 2016
2 parents bf16200 + ce23e64 commit 84695ff
Show file tree
Hide file tree
Showing 107 changed files with 414 additions and 458 deletions.
6 changes: 6 additions & 0 deletions Documentation/filesystems/porting
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,9 @@ in your dentry operations instead.
set_delayed_call() where it used to set *cookie.
->put_link() is gone - just give the destructor to set_delayed_call()
in ->get_link().
--
[mandatory]
->getxattr() and xattr_handler.get() get dentry and inode passed separately.
dentry might be yet to be attached to inode, so do _not_ use its ->d_inode
in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
called before we attach dentry to inode.
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/llite/llite_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,8 @@ static inline __u64 ll_file_maxbytes(struct inode *inode)
/* llite/xattr.c */
int ll_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
ssize_t ll_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size);
ssize_t ll_getxattr(struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size);
ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size);
int ll_removexattr(struct dentry *dentry, const char *name);

Expand Down
6 changes: 2 additions & 4 deletions drivers/staging/lustre/lustre/llite/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,9 @@ int ll_getxattr_common(struct inode *inode, const char *name,
return rc;
}

ssize_t ll_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size)
ssize_t ll_getxattr(struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct inode *inode = d_inode(dentry);

LASSERT(inode);
LASSERT(name);

Expand Down
8 changes: 4 additions & 4 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
* instantiating the inode (v9fs_inode_from_fid)
*/
acl = get_cached_acl(inode, type);
BUG_ON(acl == ACL_NOT_CACHED);
BUG_ON(is_uncached_acl(acl));
return acl;
}

Expand Down Expand Up @@ -213,8 +213,8 @@ int v9fs_acl_mode(struct inode *dir, umode_t *modep,
}

static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct v9fs_session_info *v9ses;
struct posix_acl *acl;
Expand All @@ -227,7 +227,7 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
return v9fs_xattr_get(dentry, handler->name, buffer, size);

acl = v9fs_get_cached_acl(d_inode(dentry), handler->flags);
acl = v9fs_get_cached_acl(inode, handler->flags);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
if (IS_ERR(st))
return PTR_ERR(st);

v9fs_stat2inode(st, d_inode(dentry), d_inode(dentry)->i_sb);
v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb);
generic_fillattr(d_inode(dentry), stat);

p9stat_free(st);
Expand Down
4 changes: 2 additions & 2 deletions fs/9p/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
}

static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
const char *full_name = xattr_full_name(handler, name);

Expand Down
4 changes: 2 additions & 2 deletions fs/bad_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ static int bad_inode_setxattr(struct dentry *dentry, const char *name,
return -EIO;
}

static ssize_t bad_inode_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size)
static ssize_t bad_inode_getxattr(struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return -EIO;
}
Expand Down
3 changes: 0 additions & 3 deletions fs/btrfs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
}
kfree(value);

if (!IS_ERR(acl))
set_cached_acl(inode, type, acl);

return acl;
}

Expand Down
6 changes: 3 additions & 3 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -4988,7 +4988,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
goto out;

if (!S_ISDIR(inode->i_mode)) {
if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
goto out;
inode = d_inode(parent);
}
Expand All @@ -5009,7 +5009,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
break;
}

if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
break;

if (IS_ROOT(parent))
Expand Down Expand Up @@ -5422,7 +5422,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
}

while (1) {
if (!parent || d_really_is_negative(parent) || sb != d_inode(parent)->i_sb)
if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
break;

inode = d_inode(parent);
Expand Down
6 changes: 2 additions & 4 deletions fs/btrfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,9 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
}

static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct inode *inode = d_inode(dentry);

name = xattr_full_name(handler, name);
return __btrfs_getxattr(inode, name, buffer, size);
}
Expand Down
2 changes: 2 additions & 0 deletions fs/ceph/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ static inline void ceph_set_cached_acl(struct inode *inode,
spin_lock(&ci->i_ceph_lock);
if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 0))
set_cached_acl(inode, type, acl);
else
forget_cached_acl(inode, type);
spin_unlock(&ci->i_ceph_lock);
}

Expand Down
2 changes: 1 addition & 1 deletion fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ extern int ceph_setxattr(struct dentry *, const char *, const void *,
int __ceph_setxattr(struct dentry *, const char *, const void *, size_t, int);
ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t);
int __ceph_removexattr(struct dentry *, const char *);
extern ssize_t ceph_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t ceph_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
extern ssize_t ceph_listxattr(struct dentry *, char *, size_t);
extern int ceph_removexattr(struct dentry *, const char *);
extern void __ceph_build_xattrs_blob(struct ceph_inode_info *ci);
Expand Down
8 changes: 4 additions & 4 deletions fs/ceph/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,13 +804,13 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
return err;
}

ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value,
size_t size)
ssize_t ceph_getxattr(struct dentry *dentry, struct inode *inode,
const char *name, void *value, size_t size)
{
if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
return generic_getxattr(dentry, name, value, size);
return generic_getxattr(dentry, inode, name, value, size);

return __ceph_getxattr(d_inode(dentry), name, value, size);
return __ceph_getxattr(inode, name, value, size);
}

ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifs_dfs_ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
if (full_path == NULL)
goto cdda_exit;

cifs_sb = CIFS_SB(d_inode(mntpt)->i_sb);
cifs_sb = CIFS_SB(mntpt->d_sb);
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) {
mnt = ERR_CAST(tlink);
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extern int cifs_symlink(struct inode *inode, struct dentry *direntry,
extern int cifs_removexattr(struct dentry *, const char *);
extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t, int);
extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t cifs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_CIFS_NFSD_EXPORT
Expand Down
3 changes: 1 addition & 2 deletions fs/cifs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2418,8 +2418,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
int
cifs_setattr(struct dentry *direntry, struct iattr *attrs)
{
struct inode *inode = d_inode(direntry);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);

if (pTcon->unix_ext)
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name,
{
struct dentry *dentry, *alias;
struct inode *inode;
struct super_block *sb = d_inode(parent)->i_sb;
struct super_block *sb = parent->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);

cifs_dbg(FYI, "%s: for %s\n", __func__, name->name);
Expand Down
56 changes: 9 additions & 47 deletions fs/cifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,11 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
int rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
unsigned int xid;
struct cifs_sb_info *cifs_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
struct super_block *sb;
char *full_path = NULL;

if (direntry == NULL)
return -EIO;
if (d_really_is_negative(direntry))
return -EIO;
sb = d_inode(direntry)->i_sb;
if (sb == NULL)
return -EIO;

cifs_sb = CIFS_SB(sb);
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
return PTR_ERR(tlink);
Expand Down Expand Up @@ -103,21 +93,12 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
int rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
unsigned int xid;
struct cifs_sb_info *cifs_sb;
struct super_block *sb = direntry->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
struct super_block *sb;
char *full_path;

if (direntry == NULL)
return -EIO;
if (d_really_is_negative(direntry))
return -EIO;
sb = d_inode(direntry)->i_sb;
if (sb == NULL)
return -EIO;

cifs_sb = CIFS_SB(sb);
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
return PTR_ERR(tlink);
Expand Down Expand Up @@ -232,27 +213,18 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
return rc;
}

ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
void *ea_value, size_t buf_size)
ssize_t cifs_getxattr(struct dentry *direntry, struct inode *inode,
const char *ea_name, void *ea_value, size_t buf_size)
{
ssize_t rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
unsigned int xid;
struct cifs_sb_info *cifs_sb;
struct super_block *sb = direntry->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
struct super_block *sb;
char *full_path;

if (direntry == NULL)
return -EIO;
if (d_really_is_negative(direntry))
return -EIO;
sb = d_inode(direntry)->i_sb;
if (sb == NULL)
return -EIO;

cifs_sb = CIFS_SB(sb);
tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink))
return PTR_ERR(tlink);
Expand Down Expand Up @@ -324,7 +296,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
goto get_ea_exit; /* rc already EOPNOTSUPP */

pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
d_inode(direntry), full_path, &acllen);
inode, full_path, &acllen);
if (IS_ERR(pacl)) {
rc = PTR_ERR(pacl);
cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
Expand Down Expand Up @@ -374,21 +346,11 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
ssize_t rc = -EOPNOTSUPP;
#ifdef CONFIG_CIFS_XATTR
unsigned int xid;
struct cifs_sb_info *cifs_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
struct super_block *sb;
char *full_path;

if (direntry == NULL)
return -EIO;
if (d_really_is_negative(direntry))
return -EIO;
sb = d_inode(direntry)->i_sb;
if (sb == NULL)
return -EIO;

cifs_sb = CIFS_SB(sb);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
return -EOPNOTSUPP;

Expand Down
5 changes: 4 additions & 1 deletion fs/ecryptfs/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,9 @@ int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode)
ssize_t size;
int rc = 0;

size = ecryptfs_getxattr_lower(lower_dentry, ECRYPTFS_XATTR_NAME,
size = ecryptfs_getxattr_lower(lower_dentry,
ecryptfs_inode_to_lower(ecryptfs_inode),
ECRYPTFS_XATTR_NAME,
page_virt, ECRYPTFS_DEFAULT_EXTENT_SIZE);
if (size < 0) {
if (unlikely(ecryptfs_verbosity > 0))
Expand All @@ -1391,6 +1393,7 @@ int ecryptfs_read_and_validate_xattr_region(struct dentry *dentry,
int rc;

rc = ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry),
ecryptfs_inode_to_lower(inode),
ECRYPTFS_XATTR_NAME, file_size,
ECRYPTFS_SIZE_AND_MARKER_BYTES);
if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
Expand Down
4 changes: 2 additions & 2 deletions fs/ecryptfs/ecryptfs_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
unsigned char *src, struct dentry *ecryptfs_dentry);
int ecryptfs_truncate(struct dentry *dentry, loff_t new_length);
ssize_t
ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name,
void *value, size_t size);
ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode,
const char *name, void *value, size_t size);
int
ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags);
Expand Down
Loading

0 comments on commit 84695ff

Please sign in to comment.