[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+zeu658Vi7boyxZ@casper.infradead.org>
Date: Wed, 15 Feb 2023 13:31:39 +0000
From: Matthew Wilcox <willy@...radead.org>
To: void0red <void0red@...il.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xa_load() needs a NULL check before locking check
On Wed, Feb 15, 2023 at 09:14:17PM +0800, void0red wrote:
> folio = xa_load(&ractl->mapping->i_pages, ractl->_index);
> + if (!folio) {
> + VM_BUG_ON(!folio);
> + return NULL;
> + }
> VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
Why does this need to happen? The caller has inserted all these folios
into the xarray. They're locked, so they can't be removed. If they're
not there, something has gone horribly wrong and crashing is a good
response.
> ractl->_batch_count = folio_nr_pages(folio);
>
> --
> 2.34.1
>
Powered by blists - more mailing lists