linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 9/9] xfs: turn the XFS_DA_OP_REPLACE checks in xfs_attr_shortform_addname into asserts
Date: Tue, 19 Dec 2023 23:09:42 -0800	[thread overview]
Message-ID: <20231220070942.GP361584@frogsfrogsfrogs> (raw)
In-Reply-To: <20231220063503.1005804-10-hch@lst.de>

On Wed, Dec 20, 2023 at 07:35:03AM +0100, Christoph Hellwig wrote:
> Since commit deed9512872d ("xfs: Check for -ENOATTR or -EEXIST"), the
> high-level attr code does a lookup for any attr we're trying to set,
> and does the checks to handle the create vs replace cases, which thus
> never hit the low-level attr code.
> 
> Turn the checks in xfs_attr_shortform_addname as they must never trip.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks ok,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_attr.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index ec4061db7ffccd..9976a00a73f99c 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -1072,8 +1072,7 @@ xfs_attr_shortform_addname(
>  	if (xfs_attr_sf_findname(args)) {
>  		int		error;
>  
> -		if (!(args->op_flags & XFS_DA_OP_REPLACE))
> -			return -EEXIST;
> +		ASSERT(args->op_flags & XFS_DA_OP_REPLACE);
>  
>  		error = xfs_attr_sf_removename(args);
>  		if (error)
> @@ -1087,8 +1086,7 @@ xfs_attr_shortform_addname(
>  		 */
>  		args->op_flags &= ~XFS_DA_OP_REPLACE;
>  	} else {
> -		if (args->op_flags & XFS_DA_OP_REPLACE)
> -			return -ENOATTR;
> +		ASSERT(!(args->op_flags & XFS_DA_OP_REPLACE));
>  	}
>  
>  	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
> -- 
> 2.39.2
> 
> 

  reply	other threads:[~2023-12-20  7:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  6:34 attr cleanups v3 Christoph Hellwig
2023-12-20  6:34 ` [PATCH 1/9] xfs: make if_data a void pointer Christoph Hellwig
2023-12-20  6:34 ` [PATCH 2/9] xfs: return if_data from xfs_idata_realloc Christoph Hellwig
2023-12-20  6:34 ` [PATCH 3/9] xfs: move the xfs_attr_sf_lookup tracepoint Christoph Hellwig
2023-12-20  6:34 ` [PATCH 4/9] xfs: simplify xfs_attr_sf_findname Christoph Hellwig
2023-12-20  6:34 ` [PATCH 5/9] xfs: remove xfs_attr_shortform_lookup Christoph Hellwig
2023-12-20  6:35 ` [PATCH 6/9] xfs: use xfs_attr_sf_findname in xfs_attr_shortform_getvalue Christoph Hellwig
2023-12-20  6:35 ` [PATCH 7/9] xfs: remove struct xfs_attr_shortform Christoph Hellwig
2023-12-20  7:09   ` Darrick J. Wong
2023-12-20  6:35 ` [PATCH 8/9] xfs: remove xfs_attr_sf_hdr_t Christoph Hellwig
2023-12-20  6:35 ` [PATCH 9/9] xfs: turn the XFS_DA_OP_REPLACE checks in xfs_attr_shortform_addname into asserts Christoph Hellwig
2023-12-20  7:09   ` Darrick J. Wong [this message]
2023-12-20 21:02 ` attr cleanups v3 Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231220070942.GP361584@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).