From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Ilya Dryomov <idryomov@gmail.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH] block: release disk reference in hd_struct_free_work
Date: Tue, 1 Sep 2020 11:10:20 +0200 [thread overview]
Message-ID: <20200901091020.GA4639@lst.de> (raw)
In-Reply-To: <20200901090033.313997-1-ming.lei@redhat.com>
On Tue, Sep 01, 2020 at 05:00:33PM +0800, Ming Lei wrote:
> struct hd_struct *part =
> container_of(to_rcu_work(work), struct hd_struct, rcu_work);
> + struct gendisk *disk = part_to_disk(part);
> +
> + /*
> + * Release disk reference grabbed in delete_partition, and it should
> + * have been done in hd_struct_free(), however device's release
> + * handler can't be run in percpu_ref's ->release() callback because
> + * it is run via call_rcu().
> + */
> + put_device(disk_to_dev(disk));
The fix looks good, but the comment reads a little strange. What about:
/*
* Release the disk reference acquired in delete_partition here.
* We can't release it in hd_struct_free because the final put_device
* needs process context and thus can't be run directly from a
* percpu_ref ->release handler.
*/
prev parent reply other threads:[~2020-09-01 9:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 9:00 [PATCH] block: release disk reference in hd_struct_free_work Ming Lei
2020-09-01 9:10 ` Christoph Hellwig [this message]
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=20200901091020.GA4639@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=idryomov@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=ming.lei@redhat.com \
/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