summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);