summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-06-01 11:44:48 +0200
committerJens Axboe <axboe@kernel.dk>2023-06-05 10:53:04 -0600
commita4f75764d16bed317276b05a9fe2c179ef61680d (patch)
tree5bc303347f23ff209210b382c7b6d8f2b3bcf3b8 /block
parent66fddc25fe182fd7d28b35f4173113f3eefc7fb5 (diff)
block: avoid repeated work in blk_mark_disk_dead
Check if GD_DEAD is already set in blk_mark_disk_dead, and don't duplicate the work already done. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Acked-by: Christian Brauner <brauner@kernel.org> Acked-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Link: https://lore.kernel.org/r/20230601094459.1350643-6-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/genhd.c b/block/genhd.c
index aa327314905e..6fa926a02d85 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -575,7 +575,9 @@ void blk_mark_disk_dead(struct gendisk *disk)
/*
* Fail any new I/O.
*/
- set_bit(GD_DEAD, &disk->state);
+ if (test_and_set_bit(GD_DEAD, &disk->state))
+ return;
+
if (test_bit(GD_OWNS_QUEUE, &disk->state))
blk_queue_flag_set(QUEUE_FLAG_DYING, disk->queue);