[PATCH] md: clear the congested_fn when stopping a raid5
authorNeilBrown <neilb@suse.de>
Tue, 27 Mar 2007 05:32:14 +0000 (21:32 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 27 Mar 2007 16:05:14 +0000 (09:05 -0700)
If this mddev and queue got reused for another array that doesn't register a
congested_fn, this function would get called incorretly.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/md.c
drivers/md/raid5.c

index 6c06e825cff5af8f070ff9d370f987da7c64f34b..a9852dbdfd66e415a9cdfd2103fcb3c529842602 100644 (file)
@@ -3325,6 +3325,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
                        mddev->queue->merge_bvec_fn = NULL;
                        mddev->queue->unplug_fn = NULL;
                        mddev->queue->issue_flush_fn = NULL;
+                       mddev->queue->backing_dev_info.congested_fn = NULL;
                        if (mddev->pers->sync_request)
                                sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
 
index ae30e87bf505ba40f363e7d2231a50e647b3bc0f..4dd252864f522680b13db5df9454de48d620ce3d 100644 (file)
@@ -3646,8 +3646,8 @@ static int run(mddev_t *mddev)
 
        mddev->queue->unplug_fn = raid5_unplug_device;
        mddev->queue->issue_flush_fn = raid5_issue_flush;
-       mddev->queue->backing_dev_info.congested_fn = raid5_congested;
        mddev->queue->backing_dev_info.congested_data = mddev;
+       mddev->queue->backing_dev_info.congested_fn = raid5_congested;
 
        mddev->array_size =  mddev->size * (conf->previous_raid_disks -
                                            conf->max_degraded);
@@ -3678,6 +3678,7 @@ static int stop(mddev_t *mddev)
        mddev->thread = NULL;
        shrink_stripes(conf);
        kfree(conf->stripe_hashtbl);
+       mddev->queue->backing_dev_info.congested_fn = NULL;
        blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
        sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
        kfree(conf->disks);