aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-sysfs.c')
-rw-r--r--block/blk-sysfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index e7f9f657f105..cf150011d808 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -425,7 +425,7 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
425 if (!entry->show) 425 if (!entry->show)
426 return -EIO; 426 return -EIO;
427 mutex_lock(&q->sysfs_lock); 427 mutex_lock(&q->sysfs_lock);
428 if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) { 428 if (blk_queue_dead(q)) {
429 mutex_unlock(&q->sysfs_lock); 429 mutex_unlock(&q->sysfs_lock);
430 return -ENOENT; 430 return -ENOENT;
431 } 431 }
@@ -447,7 +447,7 @@ queue_attr_store(struct kobject *kobj, struct attribute *attr,
447 447
448 q = container_of(kobj, struct request_queue, kobj); 448 q = container_of(kobj, struct request_queue, kobj);
449 mutex_lock(&q->sysfs_lock); 449 mutex_lock(&q->sysfs_lock);
450 if (test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)) { 450 if (blk_queue_dead(q)) {
451 mutex_unlock(&q->sysfs_lock); 451 mutex_unlock(&q->sysfs_lock);
452 return -ENOENT; 452 return -ENOENT;
453 } 453 }
@@ -479,8 +479,12 @@ static void blk_release_queue(struct kobject *kobj)
479 479
480 blk_sync_queue(q); 480 blk_sync_queue(q);
481 481
482 if (q->elevator) 482 if (q->elevator) {
483 spin_lock_irq(q->queue_lock);
484 ioc_clear_queue(q);
485 spin_unlock_irq(q->queue_lock);
483 elevator_exit(q->elevator); 486 elevator_exit(q->elevator);
487 }
484 488
485 blk_throtl_exit(q); 489 blk_throtl_exit(q);
486 490
@@ -494,6 +498,8 @@ static void blk_release_queue(struct kobject *kobj)
494 blk_trace_shutdown(q); 498 blk_trace_shutdown(q);
495 499
496 bdi_destroy(&q->backing_dev_info); 500 bdi_destroy(&q->backing_dev_info);
501
502 ida_simple_remove(&blk_queue_ida, q->id);
497 kmem_cache_free(blk_requestq_cachep, q); 503 kmem_cache_free(blk_requestq_cachep, q);
498} 504}
499 505