Re: [PATCH] Revert "bcache: fix improper use of bi_end_io"

Kent Overstreet <[email protected]> Tue, 13 Jan 2026 03:39:28 -0500
Newsgroups org.kernel.vger.linux-bcache,org.kernel.vger.linux-block
Message-ID <[email protected]>
On Tue, Jan 13, 2026 at 12:34:36AM -0800, Christoph Hellwig wrote:
> On Tue, Jan 13, 2026 at 03:30:41AM -0500, Kent Overstreet wrote:
> > On Tue, Jan 13, 2026 at 12:07:54AM -0800, Christoph Hellwig wrote:
> > > On Tue, Jan 13, 2026 at 02:09:39PM +0800, [email protected] wrote:
> > > > From: Coly Li <[email protected]>
> > > > 
> > > > This reverts commit 53280e398471f0bddbb17b798a63d41264651325.
> > > > 
> > > > The above commit tries to address the race in bio chain handling,
> > > > but it seems in detached_dev_end_io() simply using bio_endio() to
> > > > replace bio->bi_end_io() may introduce potential regression.
> > > > 
> > > > This patch revert the commit, let's wait for better fix from Shida.
> > > 
> > > That's a pretty vague commit message for reverting a clear API
> > > violation that has caused trouble.  What is the story here?
> > 
> > Christoph, you can't call bio_endio() on the same bio twice. You should
> > know this. Calling a bare bi_end_io function is the correct thing to do
> > when we're getting called from bio_endio().
> 
> Hi Kent,
> 
> indeed, calling bio_endio() twice is a very bad idea.  Nothing in the
> quoted commit log indicates that is the case, though.  If that is
> the problem it needs to be fixed, but calling ->bi_end_io directly
> is not the proper fix either.  That's eaxtly why I'm asking for the
> story behind this.

No. The original (buggy) patch has your name on it in the suggested-by,
you should have done your homework.

This almost made it into a bunch of stable releases, where it would have
exploded as soon as it hit actual users, and I would've gotten some of
those bug reports.

You need to reexamine your priorities here.