summaryrefslogtreecommitdiff
path: root/Documentation/staging
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2020-10-29 20:05:00 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-05 11:51:58 +0100
commitb602720eaf0de597a116325b016cc739395c7899 (patch)
tree8eff05a7cc576fcc672061c5fd3433453cd5dd83 /Documentation/staging
parent02d74bee80e0d2b1cf2fce8eb71ce8b06daf381f (diff)
null_blk: Fix locking in zoned mode
commit aa1c09cb65e2ed17cb8e652bc7ec84e0af1229eb upstream. When the zoned mode is enabled in null_blk, Serializing read, write and zone management operations for each zone is necessary to protect device level information for managing zone resources (zone open and closed counters) as well as each zone condition and write pointer position. Commit 35bc10b2eafb ("null_blk: synchronization fix for zoned device") introduced a spinlock to implement this serialization. However, when memory backing is also enabled, GFP_NOIO memory allocations are executed under the spinlock, resulting in might_sleep() warnings. Furthermore, the zone_lock spinlock is locked/unlocked using spin_lock_irq/spin_unlock_irq, similarly to the memory backing code with the nullb->lock spinlock. This nested use of irq locks wrecks the irq enabled/disabled state. Fix all this by introducing a bitmap for per-zone lock, with locking implemented using wait_on_bit_lock_io() and clear_and_wake_up_bit(). This locking mechanism allows keeping a zone locked while executing null_process_cmd(), serializing all operations to the zone while allowing to sleep during memory backing allocation with GFP_NOIO. Device level zone resource management information is protected using a spinlock which is not held while executing null_process_cmd(); Fixes: 35bc10b2eafb ("null_blk: synchronization fix for zoned device") Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/staging')
0 files changed, 0 insertions, 0 deletions