Re: [GIT PULL] Btrfs fixes for 5.19-rc7

From: David Sterba
Date: Thu Jul 21 2022 - 10:50:11 EST


On Sat, Jul 16, 2022 at 04:34:12PM +0100, Matthew Wilcox wrote:
> On Sat, Jul 16, 2022 at 04:06:20PM +0200, David Sterba wrote:
> > Note about the xarray API:
> >
> > The possible sleeping is documented next to xa_insert, however there's
> > no runtime check for that, like is eg. in radix_tree_preload. The
> > context does not need to be atomic so it's not as simple as
> >
> > might_sleep_if(gfpflags_allow_blocking(gfp));
> >
> > or
> >
> > WARN_ON_ONCE(gfpflags_allow_blocking(gfp));
> >
> > Some kind of development time debugging/assertion aid would be nice.
>
> Are you saying that
> https://git.infradead.org/users/willy/xarray.git/commitdiff/c195d497ca1ff673c2e6935152a0a5b6be2efdc9
>
> is wrong? It's been in linux-next for the last week since you drew it
> to my attention that this would be useful.

I have misinterpreted what might_sleep_if does in case it's under mutex,
it won't warn so the linked commit (adding might_alloc) should be
enough, thanks.