mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Stephen Zhang <starzhangzsd@gmail.com>
Cc: Coly Li <colyli@fnnas.com>, Christoph Hellwig <hch@infradead.org>,
	kent.overstreet@linux.dev, axboe@kernel.dk, sashal@kernel.org,
	linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhangshida@kylinos.cn
Subject: Re: [PATCH] bcache: fix double bio_endio completion in detached_dev_end_io
Date: Mon, 19 Jan 2026 00:04:06 -0800	[thread overview]
Message-ID: <aW3ldtLV_IwIj9QR@infradead.org> (raw)
In-Reply-To: <CANubcdWajHf_vJQpcsmLvU8U=Vd9Q2=9E4_mpncRy2A0iiMnWQ@mail.gmail.com>

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.


  reply	other threads:[~2026-01-19  8:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15  7:48 zhangshida
2026-01-15  8:06 ` Stephen Zhang
2026-01-15  8:29   ` Christoph Hellwig
2026-01-18 11:49     ` Coly Li
2026-01-19  6:43       ` Christoph Hellwig
2026-01-19  8:19         ` Coly Li
2026-01-19  8:29           ` Christoph Hellwig
2026-01-19  8:51             ` Coly Li
2026-01-19  6:53       ` Stephen Zhang
2026-01-19  8:04         ` Christoph Hellwig [this message]
2026-01-15  8:59   ` Kent Overstreet
2026-01-15  9:17     ` Stephen Zhang
2026-01-15  9:28       ` Kent Overstreet

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=aW3ldtLV_IwIj9QR@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=colyli@fnnas.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=starzhangzsd@gmail.com \
    --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

all inboxes | Powered by JetHome®