Skip to content

Commit

Permalink
block: avoid repeated work in blk_mark_disk_dead
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jun 5, 2023
1 parent 66fddc2 commit a4f7576
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a4f7576

Please sign in to comment.