diff options
-rw-r--r-- | block/blk-core.c | 2 | ||||
-rw-r--r-- | fs/block_dev.c | 2 | ||||
-rw-r--r-- | mm/backing-dev.c | 16 |
3 files changed, 18 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index ac0fa10f8fa5..71da5111120c 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1161,7 +1161,7 @@ static int __make_request(struct request_queue *q, struct bio *bio) | |||
1161 | const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK; | 1161 | const unsigned int ff = bio->bi_rw & REQ_FAILFAST_MASK; |
1162 | int rw_flags; | 1162 | int rw_flags; |
1163 | 1163 | ||
1164 | if (bio_rw_flagged(bio, BIO_RW_BARRIER) && bio_has_data(bio) && | 1164 | if (bio_rw_flagged(bio, BIO_RW_BARRIER) && |
1165 | (q->next_ordered == QUEUE_ORDERED_NONE)) { | 1165 | (q->next_ordered == QUEUE_ORDERED_NONE)) { |
1166 | bio_endio(bio, -EOPNOTSUPP); | 1166 | bio_endio(bio, -EOPNOTSUPP); |
1167 | return 0; | 1167 | return 0; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 9cf4b926f8e4..8bed0557d88c 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1248,8 +1248,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1248 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); | 1248 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); |
1249 | } | 1249 | } |
1250 | } else { | 1250 | } else { |
1251 | put_disk(disk); | ||
1252 | module_put(disk->fops->owner); | 1251 | module_put(disk->fops->owner); |
1252 | put_disk(disk); | ||
1253 | disk = NULL; | 1253 | disk = NULL; |
1254 | if (bdev->bd_contains == bdev) { | 1254 | if (bdev->bd_contains == bdev) { |
1255 | if (bdev->bd_disk->fops->open) { | 1255 | if (bdev->bd_disk->fops->open) { |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 5a37e2055717..1065b715ef64 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -610,6 +610,21 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi) | |||
610 | kthread_stop(wb->task); | 610 | kthread_stop(wb->task); |
611 | } | 611 | } |
612 | 612 | ||
613 | /* | ||
614 | * This bdi is going away now, make sure that no super_blocks point to it | ||
615 | */ | ||
616 | static void bdi_prune_sb(struct backing_dev_info *bdi) | ||
617 | { | ||
618 | struct super_block *sb; | ||
619 | |||
620 | spin_lock(&sb_lock); | ||
621 | list_for_each_entry(sb, &super_blocks, s_list) { | ||
622 | if (sb->s_bdi == bdi) | ||
623 | sb->s_bdi = NULL; | ||
624 | } | ||
625 | spin_unlock(&sb_lock); | ||
626 | } | ||
627 | |||
613 | void bdi_unregister(struct backing_dev_info *bdi) | 628 | void bdi_unregister(struct backing_dev_info *bdi) |
614 | { | 629 | { |
615 | if (bdi->dev) { | 630 | if (bdi->dev) { |
@@ -682,6 +697,7 @@ void bdi_destroy(struct backing_dev_info *bdi) | |||
682 | spin_unlock(&inode_lock); | 697 | spin_unlock(&inode_lock); |
683 | } | 698 | } |
684 | 699 | ||
700 | bdi_prune_sb(bdi); | ||
685 | bdi_unregister(bdi); | 701 | bdi_unregister(bdi); |
686 | 702 | ||
687 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) | 703 | for (i = 0; i < NR_BDI_STAT_ITEMS; i++) |