summaryrefslogtreecommitdiff
path: root/drivers/block/null_blk.h
diff options
context:
space:
mode:
authorKanchan Joshi <joshi.k@samsung.com>2020-09-28 12:55:49 +0300
committerJens Axboe <axboe@kernel.dk>2020-10-28 05:40:42 +0300
commit35bc10b2eafbb701064b94f283b77c54d3304842 (patch)
tree661c7d397dc63b891f6c934f3658244e1de5edf2 /drivers/block/null_blk.h
parentf255c19b3ab46d3cad3b1b2e1036f4c926cb1d0c (diff)
downloadlinux-35bc10b2eafbb701064b94f283b77c54d3304842.tar.xz
null_blk: synchronization fix for zoned device
Parallel write,read,zone-mgmt operations accessing/altering zone state and write-pointer may get into race. Avoid the situation by using a new spinlock for zoned device. Concurrent zone-appends (on a zone) returning same write-pointer issue is also avoided using this lock. Cc: stable@vger.kernel.org Fixes: e0489ed5daeb ("null_blk: Support REQ_OP_ZONE_APPEND") Signed-off-by: Kanchan Joshi <joshi.k@samsung.com> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/null_blk.h')
-rw-r--r--drivers/block/null_blk.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/null_blk.h b/drivers/block/null_blk.h
index d2e7db43a52a..3176b269b822 100644
--- a/drivers/block/null_blk.h
+++ b/drivers/block/null_blk.h
@@ -47,6 +47,7 @@ struct nullb_device {
unsigned int nr_zones_closed;
struct blk_zone *zones;
sector_t zone_size_sects;
+ spinlock_t zone_lock;
unsigned long size; /* device size in MB */
unsigned long completion_nsec; /* time in ns to complete a request */