linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Chandan Babu R <chandanbabu@kernel.org>,
	linux-block@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [BUG REPORT] General protection fault while discarding extents on XFS on next-20240305
Date: Wed, 6 Mar 2024 07:36:43 -0700	[thread overview]
Message-ID: <Zeh_e2tUpx-HzCed@kbusch-mbp> (raw)
In-Reply-To: <Zehi_bLuwz9PcbN9@infradead.org>

On Wed, Mar 06, 2024 at 04:35:09AM -0800, Christoph Hellwig wrote:
> On Wed, Mar 06, 2024 at 12:49:29PM +0530, Chandan Babu R wrote:
> > The above *probably* occured because __blkdev_issue_discard() noticed a pending
> > signal, processed the bio, freed the bio and returned a non-NULL bio pointer
> > to the caller (i.e. xfs_discard_extents()).
> > 
> > xfs_discard_extents() then tries to process the freed bio once again.
> 
> Yes, __blkdev_issue_discard really needs to clear *biop to NULL for
> this case, i.e.:
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index dc8e35d0a51d6d..26850d4895cdaf 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -99,6 +99,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
>  		cond_resched();
>  		if (fatal_signal_pending(current)) {
>  			await_bio_chain(bio);
> +			*biop = NULL;
>  			return -EINTR;
>  		}
>  	}

But everyone who calls this already sets their local bio to NULL by
default, and __blkdev_issue_discard updates *biop only on success, so
'*biop' should already be NULL here. ?

  reply	other threads:[~2024-03-06 14:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  7:19 [BUG REPORT] General protection fault while discarding extents on XFS on next-20240305 Chandan Babu R
2024-03-06 12:35 ` Christoph Hellwig
2024-03-06 14:36   ` Keith Busch [this message]
2024-03-06 14:40     ` Keith Busch
2024-03-06 14:45       ` Christoph Hellwig
2024-03-06 15:18         ` Christoph Hellwig
2024-03-06 20:51           ` Dave Chinner
2024-03-06 22:16             ` Christoph Hellwig
2024-03-07  9:21               ` Nilay Shroff

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=Zeh_e2tUpx-HzCed@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=chandanbabu@kernel.org \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.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).