aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-04-14 03:15:37 -0400
committerNeilBrown <neilb@suse.de>2010-05-17 00:45:40 -0400
commita64c876fd357906a1f7193723866562ad290654c (patch)
tree077fcdab730d40227585025bf15bf8e027949a29 /drivers/md/raid5.c
parentb6eb127d274385d81ce8dd45c98190f097bce1b4 (diff)
md: manage redundancy group in sysfs when changing level.
Some levels expect the 'redundancy group' to be present, others don't. So when we change level of an array we might need to add or remove this group. This requires fixing up the current practice of overloading ->private to indicate (when ->pers == NULL) that something needs to be removed. So create a new ->to_remove to fill that role. When changing levels, we may need to add or remove attributes. When changing RAID5 -> RAID6, we both add and remove the same thing. It is important to catch this and optimise it out as the removal is delayed until a lock is released, so trying to add immediately would cause problems. Cc: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 70ffbd071b2e..a361398875d0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5090,7 +5090,9 @@ static int run(mddev_t *mddev)
5090 } 5090 }
5091 5091
5092 /* Ok, everything is just fine now */ 5092 /* Ok, everything is just fine now */
5093 if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group)) 5093 if (mddev->to_remove == &raid5_attrs_group)
5094 mddev->to_remove = NULL;
5095 else if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
5094 printk(KERN_WARNING 5096 printk(KERN_WARNING
5095 "raid5: failed to create sysfs attributes for %s\n", 5097 "raid5: failed to create sysfs attributes for %s\n",
5096 mdname(mddev)); 5098 mdname(mddev));
@@ -5137,7 +5139,8 @@ static int stop(mddev_t *mddev)
5137 mddev->queue->backing_dev_info.congested_fn = NULL; 5139 mddev->queue->backing_dev_info.congested_fn = NULL;
5138 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 5140 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
5139 free_conf(conf); 5141 free_conf(conf);
5140 mddev->private = &raid5_attrs_group; 5142 mddev->private = NULL;
5143 mddev->to_remove = &raid5_attrs_group;
5141 return 0; 5144 return 0;
5142} 5145}
5143 5146