public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Alex Dubov <oakad@yahoo.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-block@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-mmc@vger.kernel.org
Subject: Re: [PATCH 2/5] memstick/ms_block: simplify refcounting
Date: Fri, 11 Feb 2022 10:35:09 +0800	[thread overview]
Message-ID: <YgXLXcwf8fLK3yti@T590> (raw)
In-Reply-To: <20220209082121.2628452-3-hch@lst.de>

On Wed, Feb 09, 2022 at 09:21:17AM +0100, Christoph Hellwig wrote:
> Implement the ->free_disk method to free the msb_data structure only once
> the last gendisk reference goes away instead of keeping a local refcount.
> 

The approach looks good, just the error handling needs to be careful,
such as, once driver data is bound to disk->private_data, the previous
error handling code shouldn't touch/free the driver data any more. That
said assigning disk->private_data implies driver data ownership transfer
after this conversion.

Such as, in msb_init_disk(), once blk_cleanup_disk() is done, the code
branch of out_release_id shouldn't be run; msb_probe() has the similar
issue too.

Thanks,
Ming


  reply	other threads:[~2022-02-11  2:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  8:21 add a ->free_disk block_device_operation v2 Christoph Hellwig
2022-02-09  8:21 ` [PATCH 1/5] block: add a ->free_disk method Christoph Hellwig
2022-02-09  8:21 ` [PATCH 2/5] memstick/ms_block: simplify refcounting Christoph Hellwig
2022-02-11  2:35   ` Ming Lei [this message]
2022-02-09  8:21 ` [PATCH 3/5] memstick/mspro_block: fix handling of read-only devices Christoph Hellwig
2022-02-09  8:21 ` [PATCH 4/5] memstick/mspro_block: simplify refcounting Christoph Hellwig
2022-02-09  8:21 ` [PATCH 5/5] virtio_blk: " Christoph Hellwig
2022-02-09  8:27   ` Michael S. Tsirkin
2022-02-09  9:38   ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2022-02-15  9:45 add a ->free_disk block_device_operation v3 Christoph Hellwig
2022-02-15  9:45 ` [PATCH 2/5] memstick/ms_block: simplify refcounting 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=YgXLXcwf8fLK3yti@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jasowang@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=mst@redhat.com \
    --cc=oakad@yahoo.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=ulf.hansson@linaro.org \
    --cc=virtualization@lists.linux-foundation.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