* [PATCH 5/7] md/raid5: don't record new size if resize_stripes fails.
[not found] <20150508085345.19179.8866.stgit@notabene.brown>
@ 2015-05-08 8:56 ` NeilBrown
0 siblings, 0 replies; only message in thread
From: NeilBrown @ 2015-05-08 8:56 UTC (permalink / raw)
To: linux-raid, Shaohua Li; +Cc: linux-nfs, v2.6.17+
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")
Cc: stable@vger.kernel.org (v2.6.17+)
Signed-off-by: NeilBrown <neilb@suse.de>
---
drivers/md/raid5.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 85dc0e67fb88..9748e525e4c0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2216,7 +2216,8 @@ static int resize_stripes(struct r5conf *conf, int newsize)
conf->slab_cache = sc;
conf->active_name = 1-conf->active_name;
- conf->pool_size = newsize;
+ if (!err)
+ conf->pool_size = newsize;
return err;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-05-08 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150508085345.19179.8866.stgit@notabene.brown>
2015-05-08 8:56 ` [PATCH 5/7] md/raid5: don't record new size if resize_stripes fails NeilBrown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox