summaryrefslogtreecommitdiffstats
path: root/drivers/block/rnbd/rnbd-clt.c
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2020-10-29 12:05:00 +0100
committerJens Axboe <axboe@kernel.dk>2020-10-29 14:27:30 +0100
commitaa1c09cb65e2ed17cb8e652bc7ec84e0af1229eb (patch)
treefbb60901dd8ed079fe2f191e88b9f636c4f55d19 /drivers/block/rnbd/rnbd-clt.c
parentnull_blk: Fix zone reset all tracing (diff)
downloadlinux-aa1c09cb65e2ed17cb8e652bc7ec84e0af1229eb.tar.xz
linux-aa1c09cb65e2ed17cb8e652bc7ec84e0af1229eb.zip
null_blk: Fix locking in zoned mode
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>
Diffstat (limited to 'drivers/block/rnbd/rnbd-clt.c')
0 files changed, 0 insertions, 0 deletions