diff mbox

[03/24] md/raid5: ensure we create a unique name for kmem_cache when mddev has no gendisk

Message ID 20100601095618.565.91239.stgit@notabene.brown (mailing list archive)
State Accepted, archived
Delegated to: Jonthan Brassow
Headers show

Commit Message

NeilBrown June 1, 2010, 9:56 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 8647705..74e36a2 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1269,10 +1269,14 @@  static int grow_stripes(raid5_conf_t *conf, int num)
 	struct kmem_cache *sc;
 	int devs = max(conf->raid_disks, conf->previous_raid_disks);
 
-	sprintf(conf->cache_name[0],
-		"raid%d-%s", conf->level, mdname(conf->mddev));
-	sprintf(conf->cache_name[1],
-		"raid%d-%s-alt", conf->level, mdname(conf->mddev));
+	if (conf->mddev->gendisk)
+		sprintf(conf->cache_name[0],
+			"raid%d-%s", conf->level, mdname(conf->mddev));
+	else
+		sprintf(conf->cache_name[0],
+			"raid%d-%p", conf->level, conf->mddev);
+	sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]);
+
 	conf->active_name = 0;
 	sc = kmem_cache_create(conf->cache_name[conf->active_name],
 			       sizeof(struct stripe_head)+(devs-1)*sizeof(struct r5dev),
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 0f86f5e..bb7ab92 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -388,7 +388,7 @@  struct raid5_private_data {
 	 * two caches.
 	 */
 	int			active_name;
-	char			cache_name[2][20];
+	char			cache_name[2][32];
 	struct kmem_cache		*slab_cache; /* for allocating stripes */
 
 	int			seq_flush, seq_write;