Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit de03e638 authored by Jan Kara's avatar Jan Kara Committed by Gerrit - the friendly Code Review server
Browse files

block: Allow bdi re-registration



SCSI can call device_add_disk() several times for one request queue when
a device in unbound and bound, creating new gendisk each time. This will
lead to bdi being repeatedly registered and unregistered. This was not a
big problem until commit 165a5e22fafb "block: Move bdi_unregister() to
del_gendisk()" since bdi was only registered repeatedly (bdi_register()
handles repeated calls fine, only we ended up leaking reference to
gendisk due to overwriting bdi->owner) but unregistered only in
blk_cleanup_queue() which didn't get called repeatedly. After
165a5e22fafb we were doing correct bdi_register() - bdi_unregister()
cycles however bdi_unregister() is not prepared for it. So make sure
bdi_unregister() cleans up bdi in such a way that it is prepared for
a possible following bdi_register() call.

An easy way to provoke this behavior is to enable
CONFIG_DEBUG_TEST_DRIVER_REMOVE and use scsi_debug driver to create a
scsi disk which immediately hangs without this fix.

Change-Id: Ie5502310e82cbb348ab5a3dfb96d96057c741ac4
Fixes: 165a5e22fafb127ecb5914e12e8c32a1f0d3f820
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Tested-by: default avatarOmar Sandoval <osandov@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Git-commit: b6f8fec4448aa52a8c36a392aa1ca2ea99acd460
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git


Signed-off-by: default avatarRitesh Harjani <riteshh@codeaurora.org>
parent cefff54f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment