Skip to contentSkip to conversation

Patch "md/raid5: don't record new size if resize_stripes fails." has been added to the 3.10-stable tree

PATCH [email protected] 1 participant 1 message Jun 3, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

md/raid5: don't record new size if resize_stripes fails.

to the 3.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
md-raid5-don-t-record-new-size-if-resize_stripes-fails.patch
and it can be found in the queue-3.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6e9eac2dcee5e19f125967dd2be3e36558c42fff Mon Sep 17 00:00:00 2001

From: NeilBrown <[email protected]>
Date: Fri, 8 May 2015 18:19:34 +1000
Subject: md/raid5: don't record new size if resize_stripes fails.

From: NeilBrown <[email protected]>

commit 6e9eac2dcee5e19f125967dd2be3e36558c42fff upstream.

If any memory allocation in resize_stripes fails we will return -ENOMEM, but in some cases we update conf->pool_size anyway.

This means that if we try again, the allocations will be assumed to be larger than they are, and badness results.

So only update pool_size if there is no error.

This bug was introduced in 2.6.17 and the patch is suitable for -stable.

Fixes ad01c9e3752f ("[PATCH] md: Allow stripes to be expanded in preparation for expanding an array")
---
 drivers/md/raid5.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/raid5.c +2 -1
@@ -1701,7 +1701,8 @@ static int resize_stripes(struct r5conf
 
 	conf->slab_cache = sc;
 	conf->active_name = 1-conf->active_name;
-	conf->pool_size = newsize;
+	if (!err)
+		conf->pool_size = newsize;
 	return err;
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-3.10/md-raid5-don-t-record-new-size-if-resize_stripes-fails.patch