diff options
Diffstat (limited to 'mm/backing-dev.c')
-rw-r--r-- | mm/backing-dev.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 5a37e2055717..11aee09dd2a6 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -610,9 +610,26 @@ 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) { |
631 | bdi_prune_sb(bdi); | ||
632 | |||
616 | if (!bdi_cap_flush_forker(bdi)) | 633 | if (!bdi_cap_flush_forker(bdi)) |
617 | bdi_wb_shutdown(bdi); | 634 | bdi_wb_shutdown(bdi); |
618 | bdi_debug_unregister(bdi); | 635 | bdi_debug_unregister(bdi); |