Commit a4f75764 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Acked-by: default avatarChristian Brauner <brauner@kernel.org>
Acked-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Link: https://lore.kernel.org/r/20230601094459.1350643-6-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 66fddc25
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment