From: Han Xing Yi <hxingyi104@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] Xarray: Fix race in xa_get_order()
Date: Sun, 3 Mar 2024 22:40:39 +0800 [thread overview]
Message-ID: <ZeSL553Gwajt7dPE@desktop-cluster-2.tailce565.ts.net> (raw)
In-Reply-To: <ZeRo2Y_RKEZ2op4i@casper.infradead.org>
On Sun, Mar 03, 2024 at 12:11:05PM +0000, Matthew Wilcox wrote:
> On Sat, Mar 02, 2024 at 10:13:28PM +0800, Han Xing Yi wrote:
> > Hello! This is my first patch ever, so please bear with me if I make some rookie
> > mistakes. I've tried my best to follow the documentation :)
>
> Thanks! This is indeed a mistake. Probably a harmless one, but worth
> fixing to silence the warning.
Yeah, it is probably harmless since the RCU write means that either the
old or new value will be read, but not a temporary value. Thanks for
pointing this out!
> Annoyingly, building with C=1 (sparse) finds the problem:
>
> CHECK ../lib/xarray.c
> ../lib/xarray.c:1779:54: warning: incorrect type in argument 1 (different address spaces)
> ../lib/xarray.c:1779:54: expected void const *entry
> ../lib/xarray.c:1779:54: got void [noderef] __rcu *
>
> so that means I got out of the habit of running sparse, and for some
> reason none of the build bots notified me of the new warning (or I
> missed that email).
I'm so sorry for this mistake, I did not build the kernel with sparse
when testing the patch. I'll be sure to do that next time around.
> This is such a common thing to do that I have a helper for it.
> So what I'll actually commit is:
>
> - if (!xa_is_sibling(xas.xa_node->slots[slot]))
> + if (!xa_is_sibling(xa_entry(xas.xa, xas.xa_node, slot)))
>
> but I'll leave your name on it since you did the actual work.
Thank you so much for fixing my mistakes and your quick response on
this, I really appreciate it :)
prev parent reply other threads:[~2024-03-03 14:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-02 14:13 [PATCH] Xarray: Fix race in xa_get_order() Han Xing Yi
2024-03-03 12:11 ` Matthew Wilcox
2024-03-03 14:40 ` Han Xing Yi [this message]
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=ZeSL553Gwajt7dPE@desktop-cluster-2.tailce565.ts.net \
--to=hxingyi104@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=willy@infradead.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).