mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
dbdc1be325
commit
9acf381f3e
4 changed files with 11 additions and 11 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue