xfs: make the reserved block permission flag explicit in xfs_attr_set

Make the use of reserved blocks an explicit parameter to xfs_attr_set.
Userspace setting XFS_ATTR_ROOT attrs should continue to be able to use
it, but for online repairs we can back out and therefore do not care.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Darrick J. Wong 2024-04-22 09:48:07 -07:00
parent e7420e75ef
commit bf61c36a45
4 changed files with 6 additions and 6 deletions

View File

@ -952,7 +952,7 @@ xfs_attr_lookup(
* Make a change to the xattr structure.
*
* The caller must have initialized @args, attached dquots, and must not hold
* any ILOCKs.
* any ILOCKs. Reserved data blocks may be used if @rsvd is set.
*
* Returns -EEXIST for XFS_ATTRUPDATE_CREATE if the name already exists.
* Returns -ENOATTR for XFS_ATTRUPDATE_REMOVE if the name does not exist.
@ -961,12 +961,12 @@ xfs_attr_lookup(
int
xfs_attr_set(
struct xfs_da_args *args,
enum xfs_attr_update op)
enum xfs_attr_update op,
bool rsvd)
{
struct xfs_inode *dp = args->dp;
struct xfs_mount *mp = dp->i_mount;
struct xfs_trans_res tres;
bool rsvd = (args->attr_filter & XFS_ATTR_ROOT);
int error, local;
int rmt_blks = 0;
unsigned int total;

View File

@ -558,7 +558,7 @@ enum xfs_attr_update {
XFS_ATTRUPDATE_REPLACE, /* set value, fail if attr does not exist */
};
int xfs_attr_set(struct xfs_da_args *args, enum xfs_attr_update op);
int xfs_attr_set(struct xfs_da_args *args, enum xfs_attr_update op, bool rsvd);
int xfs_attr_set_iter(struct xfs_attr_intent *attr);
int xfs_attr_remove_iter(struct xfs_attr_intent *attr);
bool xfs_attr_check_namespace(unsigned int attr_flags);

View File

@ -606,7 +606,7 @@ xrep_xattr_insert_rec(
* already exists, we'll just drop it during the rebuild.
*/
xfs_attr_sethash(&args);
error = xfs_attr_set(&args, XFS_ATTRUPDATE_CREATE);
error = xfs_attr_set(&args, XFS_ATTRUPDATE_CREATE, false);
if (error == -EEXIST)
error = 0;

View File

@ -110,7 +110,7 @@ xfs_attr_change(
args->whichfork = XFS_ATTR_FORK;
xfs_attr_sethash(args);
return xfs_attr_set(args, op);
return xfs_attr_set(args, op, args->attr_filter & XFS_ATTR_ROOT);
}