From: Christoph Hellwig <hch@lst.de>
To: Chandan Babu R <chandan.babu@oracle.com>
Cc: "Darrick J. Wong" <djwong@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup
Date: Tue, 19 Dec 2023 15:46:27 +0100 [thread overview]
Message-ID: <20231219144627.GA1477@lst.de> (raw)
In-Reply-To: <20231219120817.923421-6-hch@lst.de>
So, the buildbot rightly complained that this can return an
uninitialized error variable in xfs_attr_shortform_addname now
(why are we disabling the goddam use of uninitialized variable
warnings in Linux again, sigh..).
I then not only created the trivial fix, but also wrote a simple wrapper
for the setxattr syscall as the existing setfattr and attr tools don't
allow to control the flag, which I assumed means xfstests didn't really
test this as much as it should. But that little test showed we're still
getting the right errno values even with the unininitialized variable
returns, which seemed odd.
It turns out we're not even exercising this code any more, as
xfs_attr_set already does a xfs_attr_lookup lookup first and has a
copy of this logic executed much earlier (and I should have really though
about that because I got very close to that code for the defer ops
cleanup).
So.. I'm tempted to just turn these checks into asserts with something
like the below on top of this patch, I'll just need to see if it survives
testing:
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index d6173888ed0d56..abdc58f286154a 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -1066,13 +1066,13 @@ xfs_attr_shortform_addname(
struct xfs_da_args *args)
{
int newsize, forkoff;
- int error;
trace_xfs_attr_sf_addname(args);
if (xfs_attr_sf_findname(args)) {
- if (!(args->op_flags & XFS_DA_OP_REPLACE))
- return error;
+ int error;
+
+ ASSERT(args->op_flags & XFS_DA_OP_REPLACE);
error = xfs_attr_sf_removename(args);
if (error)
@@ -1086,8 +1086,7 @@ xfs_attr_shortform_addname(
*/
args->op_flags &= ~XFS_DA_OP_REPLACE;
} else {
- if (args->op_flags & XFS_DA_OP_REPLACE)
- return error;
+ ASSERT(!(args->op_flags & XFS_DA_OP_REPLACE));
}
if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
next prev parent reply other threads:[~2023-12-19 14:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 12:08 attr cleanups v2 Christoph Hellwig
2023-12-19 12:08 ` [PATCH 1/8] xfs: make if_data a void pointer Christoph Hellwig
2023-12-19 12:08 ` [PATCH 2/8] xfs: return if_data from xfs_idata_realloc Christoph Hellwig
2023-12-19 12:08 ` [PATCH 3/8] xfs: move the xfs_attr_sf_lookup tracepoint Christoph Hellwig
2023-12-19 12:08 ` [PATCH 4/8] xfs: simplify xfs_attr_sf_findname Christoph Hellwig
2023-12-19 12:08 ` [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup Christoph Hellwig
2023-12-19 14:46 ` Christoph Hellwig [this message]
2023-12-19 17:45 ` Darrick J. Wong
2023-12-20 3:55 ` Christoph Hellwig
2023-12-19 12:08 ` [PATCH 6/8] xfs: use xfs_attr_sf_findname in xfs_attr_shortform_getvalue Christoph Hellwig
2023-12-19 12:08 ` [PATCH 7/8] xfs: remove struct xfs_attr_shortform Christoph Hellwig
2023-12-19 17:35 ` Darrick J. Wong
2023-12-19 12:08 ` [PATCH 8/8] xfs: remove xfs_attr_sf_hdr_t Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2023-12-17 17:03 attr cleanups Christoph Hellwig
2023-12-17 17:03 ` [PATCH 5/8] xfs: remove xfs_attr_shortform_lookup Christoph Hellwig
2023-12-18 22:37 ` Darrick J. Wong
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=20231219144627.GA1477@lst.de \
--to=hch@lst.de \
--cc=chandan.babu@oracle.com \
--cc=djwong@kernel.org \
--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).