diff options
author | Mike Snitzer <snitzer@redhat.com> | 2018-01-09 20:46:49 -0500 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:33:25 +0800 |
commit | d16900b1250aa2fadf346842df5400c943086037 (patch) | |
tree | dcb578275da547d7d047c7a44c0cd569368017c8 /block | |
parent | ee4e916b2a0d22ba7688e8301d7af949f39c5554 (diff) |
block: only bdi_unregister() in del_gendisk() if !GENHD_FL_HIDDEN
device_add_disk() will only call bdi_register_owner() if
!GENHD_FL_HIDDEN, so it follows that del_gendisk() should only call
bdi_unregister() if !GENHD_FL_HIDDEN.
Found with code inspection. bdi_unregister() won't do any harm if
bdi_register_owner() wasn't used but best to avoid the unnecessary
call to bdi_unregister().
Fixes: 8ddcd65325 ("block: introduce GENHD_FL_HIDDEN")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit bc8d062c36e3525e81ea8237ff0ab3264c2317b6)
Diffstat (limited to 'block')
-rw-r--r-- | block/genhd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/genhd.c b/block/genhd.c index 9286834586c9..eaa902a8262f 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -734,7 +734,8 @@ void del_gendisk(struct gendisk *disk) * Unregister bdi before releasing device numbers (as they can * get reused and we'd get clashes in sysfs). */ - bdi_unregister(disk->queue->backing_dev_info); + if (!(disk->flags & GENHD_FL_HIDDEN)) + bdi_unregister(disk->queue->backing_dev_info); blk_unregister_queue(disk); } else { WARN_ON(1); |