aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-core.c3
-rw-r--r--block/blk-exec.c7
-rw-r--r--block/genhd.c10
3 files changed, 11 insertions, 9 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index b3228255304d..f8cb09951830 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -839,6 +839,9 @@ struct request *blk_get_request(struct request_queue *q, int rw, gfp_t gfp_mask)
839{ 839{
840 struct request *rq; 840 struct request *rq;
841 841
842 if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
843 return NULL;
844
842 BUG_ON(rw != READ && rw != WRITE); 845 BUG_ON(rw != READ && rw != WRITE);
843 846
844 spin_lock_irq(q->queue_lock); 847 spin_lock_irq(q->queue_lock);
diff --git a/block/blk-exec.c b/block/blk-exec.c
index 8a0e7ec056e7..a1ebceb332f9 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -50,6 +50,13 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
50{ 50{
51 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; 51 int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK;
52 52
53 if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) {
54 rq->errors = -ENXIO;
55 if (rq->end_io)
56 rq->end_io(rq, rq->errors);
57 return;
58 }
59
53 rq->rq_disk = bd_disk; 60 rq->rq_disk = bd_disk;
54 rq->end_io = done; 61 rq->end_io = done;
55 WARN_ON(irqs_disabled()); 62 WARN_ON(irqs_disabled());
diff --git a/block/genhd.c b/block/genhd.c
index fbd7605a5865..5cb51c55f6d8 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1018,14 +1018,6 @@ static const struct attribute_group *disk_attr_groups[] = {
1018 NULL 1018 NULL
1019}; 1019};
1020 1020
1021static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
1022{
1023 struct disk_part_tbl *ptbl =
1024 container_of(head, struct disk_part_tbl, rcu_head);
1025
1026 kfree(ptbl);
1027}
1028
1029/** 1021/**
1030 * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way 1022 * disk_replace_part_tbl - replace disk->part_tbl in RCU-safe way
1031 * @disk: disk to replace part_tbl for 1023 * @disk: disk to replace part_tbl for
@@ -1046,7 +1038,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,
1046 1038
1047 if (old_ptbl) { 1039 if (old_ptbl) {
1048 rcu_assign_pointer(old_ptbl->last_lookup, NULL); 1040 rcu_assign_pointer(old_ptbl->last_lookup, NULL);
1049 call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb); 1041 kfree_rcu(old_ptbl, rcu_head);
1050 } 1042 }
1051} 1043}
1052 1044