Linux block layer
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Jan Kara <jack@suse.cz>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@infradead.org>,
	linux-block@vger.kernel.org, Coly Li <colyli@suse.de>,
	linux-bcache@vger.kernel.org
Subject: Re: [PATCH 1/2] bcache: Alloc holder object before async registration
Date: Thu, 22 Jun 2023 12:09:54 +0200	[thread overview]
Message-ID: <20230622100954.6vx7725huqngbubb@quack3> (raw)
In-Reply-To: <20230621175659.ugkaawkuanlzt736@moria.home.lan>

On Wed 21-06-23 13:56:59, Kent Overstreet wrote:
> On Wed, Jun 21, 2023 at 06:23:26PM +0200, Jan Kara wrote:
> > Allocate holder object (cache or cached_dev) before offloading the
> > rest of the startup to async work. This will allow us to open the block
> > block device with proper holder.
> 
> This is a pretty big change for this fix, and we'd want to retest the
> error paths - that's hard to do, because the fault injection framework I
> was using for that never made it upstream.

I agree those are somewhat difficult to test. Although with memory
allocation error injection, we can easily simulate failures in
alloc_holder_object() or say later in bcache_device_init() if that's what
you're after to give at least some testing to the error paths. Admittedly,
I've just tested that registering and unregistering bcache devices works
without giving warnings. Or are you more worried about the "reopen the
block device" logic (and error handling) in the second patch?

> What about just exposing a proper API for changing the holder? Wouldn't
> that be simpler?

It would be doable but frankly I'd prefer to avoid implementing the API for
changing the holder just for bcache. For all I care bcache can also just
generate random cookie (or an id from IDA) and pass it as a holder to
blkdev_get_by_dev(). It would do the job as well and we then don't have to
play games with changing the holder. It would just need to be propagated to
the places doing blkdev_put(). Do you find that better?

I'm now working on a changes that will make blkdev_get_by_dev() return
bdev_handle (which contains bdev pointer but also other stuff we need to
propagate to blkdev_put()) so when that is done, the cookie propagation
will happen automatically.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2023-06-22 10:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 16:23 [PATCH 0/2] bcache: Fix block device claiming Jan Kara
2023-06-21 16:23 ` [PATCH 1/2] bcache: Alloc holder object before async registration Jan Kara
2023-06-21 17:56   ` Kent Overstreet
2023-06-22 10:09     ` Jan Kara [this message]
2023-06-22 12:05       ` Kent Overstreet
2023-06-22 15:14         ` Christoph Hellwig
2023-06-21 16:23 ` [PATCH 2/2] bcache: Fix bcache device claiming Jan Kara
2023-06-22  1:23   ` kernel test robot
2023-06-22 10:26     ` Jan Kara
2023-06-22  1:44   ` kernel test robot
2023-06-22  3:29   ` kernel test robot
2023-06-22 15:12   ` Christoph Hellwig

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=20230622100954.6vx7725huqngbubb@quack3 \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=colyli@suse.de \
    --cc=hch@infradead.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@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