public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: "Coly Li" <colyli@fnnas.com>
To: "Kent Overstreet" <kent.overstreet@linux.dev>
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>,
	 <zhangshida@kylinos.cn>
Subject: Re: Patch "bcache: fix improper use of bi_end_io" has been added to the 6.6-stable tree
Date: Tue, 13 Jan 2026 14:08:27 +0800	[thread overview]
Message-ID: <aWXgStXQyV38uz7o@studio.local> (raw)
In-Reply-To: <aWU2mO5v6RezmIpZ@moria.home.lan>

On Mon, Jan 12, 2026 at 01:01:52PM +0800, Kent Overstreet wrote:
> On Mon, Jan 12, 2026 at 12:23:45PM -0500, Sasha Levin wrote:
> > This is a note to let you know that I've just added the patch titled
> > 
> >     bcache: fix improper use of bi_end_io
> > 
> > to the 6.6-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> > 
> > The filename of the patch is:
> >      bcache-fix-improper-use-of-bi_end_io.patch
> > and it can be found in the queue-6.6 subdirectory.
> > 
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> 
> Yeah, this is broken.
> 
> Coly, please revert this.
>

Yes, let me do it.

Although I didn’t ack this patch, I read the patch and thought it was
fine, yes my fault too.

This faulty patch didn’t trigger issue on my testing machine, I guess
it was because on simple bcache setup, re-enter bio_endio() happenly
didn't actually redo things other than calling bio->bi_end_io().

I will post a revert commit to Jens.

This patch is part of the patch set to address race around bio chain
handling. Then Shida please continue to find a better version on the
fix.

Coly Li
 
> > 
> > 
> > 
> > commit 81e7e43a810e8f40e163928d441de02d2816b073
> > Author: Shida Zhang <zhangshida@kylinos.cn>
> > Date:   Tue Dec 9 17:01:56 2025 +0800
> > 
> >     bcache: fix improper use of bi_end_io
> >     
> >     [ Upstream commit 53280e398471f0bddbb17b798a63d41264651325 ]
> >     
> >     Don't call bio->bi_end_io() directly. Use the bio_endio() helper
> >     function instead, which handles completion more safely and uniformly.
> >     
> >     Suggested-by: Christoph Hellwig <hch@infradead.org>
> >     Reviewed-by: Christoph Hellwig <hch@lst.de>
> >     Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
> >     Signed-off-by: Jens Axboe <axboe@kernel.dk>
> >     Signed-off-by: Sasha Levin <sashal@kernel.org>
> > 
> > diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> > index a9b1f3896249b..b4059d2daa326 100644
> > --- a/drivers/md/bcache/request.c
> > +++ b/drivers/md/bcache/request.c
> > @@ -1090,7 +1090,7 @@ static void detached_dev_end_io(struct bio *bio)
> >  	}
> >  
> >  	kfree(ddip);
> > -	bio->bi_end_io(bio);
> > +	bio_endio(bio);
> >  }
> >  
> >  static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
> > @@ -1107,7 +1107,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
> >  	ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
> >  	if (!ddip) {
> >  		bio->bi_status = BLK_STS_RESOURCE;
> > -		bio->bi_end_io(bio);
> > +		bio_endio(bio);
> >  		return;
> >  	}
> >  
> > @@ -1122,7 +1122,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
> >  
> >  	if ((bio_op(bio) == REQ_OP_DISCARD) &&
> >  	    !bdev_max_discard_sectors(dc->bdev))
> > -		bio->bi_end_io(bio);
> > +		detached_dev_end_io(bio);
> >  	else
> >  		submit_bio_noacct(bio);
> >  }

  reply	other threads:[~2026-01-13  6:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260112172345.800703-1-sashal@kernel.org>
2026-01-12 17:34 ` Patch "bcache: fix improper use of bi_end_io" has been added to the 6.6-stable tree Kent Overstreet
2026-01-12 18:01 ` Kent Overstreet
2026-01-13  6:08   ` Coly Li [this message]
2026-01-13  6:21     ` Kent Overstreet
2026-01-15  8:47 ` Kent Overstreet
2026-01-15 11:39   ` Greg KH
2026-01-15 11:40     ` Greg KH

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=aWXgStXQyV38uz7o@studio.local \
    --to=colyli@fnnas.com \
    --cc=kent.overstreet@linux.dev \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zhangshida@kylinos.cn \
    /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