diff options
| author | Ming Lei <[email protected]> | 2021-11-11 02:03:43 +0000 |
|---|---|---|
| committer | Jens Axboe <[email protected]> | 2021-11-23 01:35:37 +0000 |
| commit | efcf5932230b9472cfdbe01c858726f29ac5ec7d (patch) | |
| tree | 81ebb94de5787993097f25294aa62fb3f426e22d /tools/perf/util/scripting-engines | |
| parent | blk-mq: don't insert FUA request with data into scheduler queue (diff) | |
| download | kernel-efcf5932230b9472cfdbe01c858726f29ac5ec7d.tar.gz kernel-efcf5932230b9472cfdbe01c858726f29ac5ec7d.zip | |
block: avoid to touch unloaded module instance when opening bdev
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 <[email protected]>
Cc: [email protected]
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'tools/perf/util/scripting-engines')
0 files changed, 0 insertions, 0 deletions
