* clean up the attr interface v6
@ 2020-02-25 19:49 Christoph Hellwig
2020-02-25 19:49 ` [PATCH 01/30] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 19:49 UTC (permalink / raw)
To: linux-xfs
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
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 01/30] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE
2020-02-25 19:49 clean up the attr interface v6 Christoph Hellwig
@ 2020-02-25 19:49 ` Christoph Hellwig
2020-02-25 19:49 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
2020-02-25 19:51 ` clean up the attr interface v6 Christoph Hellwig
2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 19:49 UTC (permalink / raw)
To: linux-xfs; +Cc: Dave Chinner, Chandan Rajendra, Darrick J . Wong
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.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/xfs_ioctl.c | 2 ++
fs/xfs/xfs_ioctl32.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index d42de92cb283..d974bf099d45 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -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))
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c
index 769581a79c58..9705172e5410 100644
--- a/fs/xfs/xfs_ioctl32.c
+++ b/fs/xfs/xfs_ioctl32.c
@@ -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))
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag
2020-02-25 19:49 clean up the attr interface v6 Christoph Hellwig
2020-02-25 19:49 ` [PATCH 01/30] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
@ 2020-02-25 19:49 ` Christoph Hellwig
2020-02-25 19:51 ` clean up the attr interface v6 Christoph Hellwig
2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 19:49 UTC (permalink / raw)
To: linux-xfs; +Cc: Dave Chinner, Darrick J . Wong
Replace the ATTR_INCOMPLETE flag with a new boolean field in struct
xfs_attr_list_context.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
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(-)
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
index 4243b2272642..71bcf1298e4c 100644
--- a/fs/xfs/libxfs/xfs_attr.h
+++ b/fs/xfs/libxfs/xfs_attr.h
@@ -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 */
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index d9f0dd444b80..d804558cdbca 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -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;
/*
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index d37743bdf274..f7c4f6b9749a 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -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.
*/
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: clean up the attr interface v6
2020-02-25 19:49 clean up the attr interface v6 Christoph Hellwig
2020-02-25 19:49 ` [PATCH 01/30] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
2020-02-25 19:49 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
@ 2020-02-25 19:51 ` Christoph Hellwig
2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 19:51 UTC (permalink / raw)
To: linux-xfs
The conference wifi is too bad for git-send-email to finish the
series. I'll retry later.
^ permalink raw reply [flat|nested] 6+ messages in thread
* clean up the attr interface v6
@ 2020-02-25 23:09 Christoph Hellwig
2020-02-25 23:09 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 23:09 UTC (permalink / raw)
To: linux-xfs
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
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag
2020-02-25 23:09 Christoph Hellwig
@ 2020-02-25 23:09 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-02-25 23:09 UTC (permalink / raw)
To: linux-xfs; +Cc: Dave Chinner, Darrick J . Wong
Replace the ATTR_INCOMPLETE flag with a new boolean field in struct
xfs_attr_list_context.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
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(-)
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
index 4243b2272642..71bcf1298e4c 100644
--- a/fs/xfs/libxfs/xfs_attr.h
+++ b/fs/xfs/libxfs/xfs_attr.h
@@ -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 */
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index d9f0dd444b80..d804558cdbca 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -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;
/*
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index d37743bdf274..f7c4f6b9749a 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -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.
*/
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* clean up the attr interface v3
@ 2020-01-29 17:02 Christoph Hellwig
2020-01-29 17:02 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2020-01-29 17:02 UTC (permalink / raw)
To: linux-xfs; +Cc: Allison Collins
xfsprogs patches porting over the libxfs changes are available here:
http://git.infradead.org/users/hch/xfsprogs.git/shortlog/refs/heads/attr-cleanup
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
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag
2020-01-29 17:02 clean up the attr interface v3 Christoph Hellwig
@ 2020-01-29 17:02 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-01-29 17:02 UTC (permalink / raw)
To: linux-xfs; +Cc: Allison Collins, Darrick J . Wong
Replace the ATTR_INCOMPLETE flag with a new boolean field in struct
xfs_attr_list_context.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_attr.h | 5 ++---
fs/xfs/scrub/attr.c | 2 +-
fs/xfs/xfs_attr_list.c | 6 +-----
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
index 4243b2272642..71bcf1298e4c 100644
--- a/fs/xfs/libxfs/xfs_attr.h
+++ b/fs/xfs/libxfs/xfs_attr.h
@@ -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 */
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index d9f0dd444b80..d804558cdbca 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -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;
/*
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index d37743bdf274..5139ef983cd6 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -452,7 +452,7 @@ xfs_attr3_leaf_list_int(
}
if ((entry->flags & XFS_ATTR_INCOMPLETE) &&
- !(context->flags & ATTR_INCOMPLETE))
+ !context->allow_incomplete)
continue; /* skip incomplete entries */
if (entry->flags & XFS_ATTR_LOCAL) {
@@ -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.
*/
--
2.24.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-25 23:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-25 19:49 clean up the attr interface v6 Christoph Hellwig
2020-02-25 19:49 ` [PATCH 01/30] xfs: reject invalid flags combinations in XFS_IOC_ATTRLIST_BY_HANDLE Christoph Hellwig
2020-02-25 19:49 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
2020-02-25 19:51 ` clean up the attr interface v6 Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2020-02-25 23:09 Christoph Hellwig
2020-02-25 23:09 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
2020-01-29 17:02 clean up the attr interface v3 Christoph Hellwig
2020-01-29 17:02 ` [PATCH 02/30] xfs: remove the ATTR_INCOMPLETE flag Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.