clean up the attr interface v6
Also available as a git tree here:
http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/xfs-attr-cleanup.6
An xfsprogs tree porting over the libxfs changes is available here:
http://git.infradead.org/users/hch/xfsprogs.git/shortlog/refs/heads/attr-cleanup
Changes since v5:
- don't move xfs_da_args
Changes since v4:
- rename the attr_namespace field to attr_filter
- drop "properly type the buffer field in struct xfs_fsop_attrlist_handlere", this was causing too much discussion for a trivial cleanup
- improve a few commit messages and comments
- improve the ATTR_REPLACE checks a little more
- turn the xfs_forget_acl stub into an inline function
- fix a 0 vs NULL sparse warning in xfs_ioc_attr_list
Changes since v3:
- clean up a cast
- fixup a comment
- fix a flags check to use the right flags (bisection only)
- move a few hunks around to better spots in the series
Changes since v2:
- add more comments
- fix up an error handling corner case in __xfs_set_acl
- add more cowbell^H^H^H^H^H^H^Hbool
- add a new patch to reject invalid namespaces flags in XFS_IOC_ATTRLIST_BY_HANDLE
- remove ATTR_ENTSIZE entirely
Changes since v1:
- rebased to for-next, which includes the fixes from the first version
PATCH 1/30 xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE
While the flags field in the ABI and the on-disk format allows for multiple namespace flags, an attribute can only exist in a single namespace at a time. Hence asking to list attributes that exist in multiple namespaces simultaneously is a logically invalid request and will return no results. Reject this case early with -EINVAL.
--- fs/xfs/xfs_ioctl.c | 2 ++ fs/xfs/xfs_ioctl32.c | 2 ++ 2 files changed, 4 insertions(+)
fs/xfs/xfs_ioctl.c +2 -0
@@ -317,6 +317,8 @@ xfs_attrlist_by_handle(*/ if (al_hreq.flags & ~(ATTR_ROOT |ATTR_SECURE ))return -EINVAL ; +if (al_hreq.flags == (ATTR_ROOT |ATTR_SECURE )) +return -EINVAL ; dentry =xfs_handlereq_to_dentry (parfilp, &al_hreq.hreq);if (IS_ERR (dentry))
fs/xfs/xfs_ioctl32.c +2 -0
@@ -375,6 +375,8 @@ xfs_compat_attrlist_by_handle(*/ if (al_hreq.flags & ~(ATTR_ROOT |ATTR_SECURE ))return -EINVAL ; +if (al_hreq.flags == (ATTR_ROOT |ATTR_SECURE )) +return -EINVAL ; dentry =xfs_compat_handlereq_to_dentry (parfilp, &al_hreq.hreq);if (IS_ERR (dentry))
Signature · 1 line
2.24.1
PATCH 2/30 xfs: remove the ATTR_INCOMPLETE flag
In reply to Christoph HellwigReplace the ATTR_INCOMPLETE flag with a new boolean field in struct xfs_attr_list_context.
--- fs/xfs/libxfs/xfs_attr.h | 5 ++--- fs/xfs/scrub/attr.c | 2 +- fs/xfs/xfs_attr_list.c | 8 ++------ 3 files changed, 5 insertions(+), 10 deletions(-)
fs/xfs/libxfs/xfs_attr.h +2 -3
@@ -36,11 +36,10 @@ struct xfs_attr_list_context;#define ATTR_KERNOTIME 0x1000/* [kernel] don't update inode timestamps */ #define ATTR_KERNOVAL 0x2000/* [kernel] get attr size only, not value */ -#define ATTR_INCOMPLETE 0x4000/* [kernel] return INCOMPLETE attr keys */ #define ATTR_ALLOC 0x8000/* [kernel] allocate xattr buffer on demand */ #define ATTR_KERNEL_FLAGS \ - (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_INCOMPLETE | ATTR_ALLOC) + (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_ALLOC)#define XFS_ATTR_FLAGS \ { ATTR_DONTFOLLOW, "DONTFOLLOW" }, \
@@ -51,7 +50,6 @@ struct xfs_attr_list_context; { ATTR_REPLACE, "REPLACE" }, \ { ATTR_KERNOTIME, "KERNOTIME" }, \ { ATTR_KERNOVAL, "KERNOVAL" }, \ - { ATTR_INCOMPLETE, "INCOMPLETE" }, \ { ATTR_ALLOC, "ALLOC" }/*
@@ -123,6 +121,7 @@ typedef struct xfs_attr_list_context {* error values to the xfs_attr_list caller. */ int seen_enough; +bool allow_incomplete;ssize_t count;/* num used entries */ int dupcnt;/* count dup hashvals seen */
fs/xfs/scrub/attr.c +1 -1
@@ -497,7 +497,7 @@ xchk_xattr( sx.context.resynch =1 ; sx.context.put_listent = xchk_xattr_listent; sx.context.tp = sc->tp; - sx.context.flags =ATTR_INCOMPLETE ; + sx.context.allow_incomplete = true; sx.sc = sc;/*
fs/xfs/xfs_attr_list.c +2 -6
@@ -452,8 +452,8 @@ xfs_attr3_leaf_list_int( }if ((entry->flags &XFS_ATTR_INCOMPLETE ) && - !(context->flags &ATTR_INCOMPLETE )) -continue ;/* skip incomplete entries */ + !context->allow_incomplete) +continue ;if (entry->flags &XFS_ATTR_LOCAL ) {xfs_attr_leaf_name_local_t *name_loc;
@@ -632,10 +632,6 @@ xfs_attr_list( (cursor->hashval || cursor->blkno || cursor->offset))return -EINVAL ; -/* Only internal consumers can retrieve incomplete attrs. */ -if (flags &ATTR_INCOMPLETE ) -return -EINVAL ; -/* * Check for a properly aligned buffer. */
Signature · 1 line
2.24.1
The conference wifi is too bad for git-send-email to finish the series. I'll retry later.