lkml.org 
[lkml]   [2023]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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
>

\
 
 \ /
  Last update: 2023-03-27 00:24    [W:0.084 / U:1.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site