summaryrefslogtreecommitdiff
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-03-30 08:29:07 +0300
committerJens Axboe <axboe@kernel.dk>2022-04-18 15:54:09 +0300
commit9acf381f3e8f715175c29f4b6d722f6b6797d139 (patch)
tree9f0a39c15820a6772d4cd0b60f458010b5ac6c64 /include/linux/blkdev.h
parentdbdc1be32591af023db2812706f01e6cd2f42bfc (diff)
downloadlinux-9acf381f3e8f715175c29f4b6d722f6b6797d139.tar.xz
block: turn bdev->bd_openers into an atomic_t
All manipulation of bd_openers is under disk->open_mutex and will remain so for the foreseeable future. But at least one place reads it without the lock (blkdev_get) and there are more to be added. So make sure the compiler does not do turn the increments and decrements into non-atomic sequences by using an atomic_t. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20220330052917.2566582-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 436645bde13f..afad3d1d0dac 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -188,7 +188,7 @@ static inline bool disk_live(struct gendisk *disk)
*/
static inline unsigned int disk_openers(struct gendisk *disk)
{
- return disk->part0->bd_openers;
+ return atomic_read(&disk->part0->bd_openers);
}
/*