linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: void0red <void0red@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xa_load() needs a NULL check before locking check
Date: Wed, 15 Feb 2023 13:31:39 +0000	[thread overview]
Message-ID: <Y+zeu658Vi7boyxZ@casper.infradead.org> (raw)
In-Reply-To: <20230215131417.150170-1-void0red@gmail.com>

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
> 

      reply	other threads:[~2023-02-15 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 13:14 [PATCH] xa_load() needs a NULL check before locking check void0red
2023-02-15 13:31 ` Matthew Wilcox [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=Y+zeu658Vi7boyxZ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=void0red@gmail.com \
    /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).