Re: [PATCH] bcache: fix double bio_endio completion in detached_dev_end_io
Christoph Hellwig <[email protected]> Mon, 19 Jan 2026 00:04:06 -0800
| Newsgroups | org.kernel.vger.linux-bcache,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Jan 19, 2026 at 02:53:53PM +0800, Stephen Zhang wrote:
> > > if (bio->bi_status) {
> > > - struct cached_dev *dc = container_of(ddip->d,
> > > - struct cached_dev, disk);
> > > + struct cached_dev *dc = bio->bi_private;
> > > +
> > > /* should count I/O error for backing device here */
> > > bch_count_backing_io_errors(dc, bio);
> > > + orig_bio->bi_status = bio->bi_status;
> > > }
> > >
>
> bio_init_clone must be paired with a bio_uninit() call before the
> memory is freed?
Yes. At least if you don't want leaks when using blk-group.
But as stated in my initial mail, as far as I can tell this path really
needs a bio_set to avoid spurious failures under memory pressure. In
which case we'd then do a bio_put in the end_io path.