From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
czhong@redhat.com
Subject: Re: [PATCH V2 1/1] block: avoid to touch unloaded module instance when opening bdev
Date: Tue, 23 Nov 2021 08:50:02 +0800 [thread overview]
Message-ID: <YZw6un6PYKE+mAMG@T590> (raw)
In-Reply-To: <20211111020343.316126-1-ming.lei@redhat.com>
On Thu, Nov 11, 2021 at 10:03:43AM +0800, Ming Lei wrote:
> disk->fops->owner is grabbed in blkdev_get_no_open() after the disk
> kobject refcount is increased. This way can't make sure that
> disk->fops->owner is still alive since del_gendisk() still can move
> on if the kobject refcount of disk is grabbed by open() and
> disk->fops->open() isn't called yet.
>
> Fixes the issue by moving try_module_get() into blkdev_get_by_dev()
> with ->open_mutex() held, then we can drain the in-progress open()
> in del_gendisk(). Meantime new open() won't succeed because disk
> becomes not alive.
>
> This way is reasonable because blkdev_get_no_open() needn't to touch
> disk->fops or defined callbacks.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: czhong@redhat.com
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> V2:
> - remove comment as suggested by Christoph
> - improve commit log a bit
Hi Jens,
Ping...
Thanks,
Ming
next prev parent reply other threads:[~2021-11-23 0:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 2:03 [PATCH V2 1/1] block: avoid to touch unloaded module instance when opening bdev Ming Lei
2021-11-11 6:21 ` Christoph Hellwig
2021-11-23 0:50 ` Ming Lei [this message]
2021-11-23 2:33 ` Jens Axboe
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=YZw6un6PYKE+mAMG@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=czhong@redhat.com \
--cc=hch@lst.de \
--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