[3.13.y.z extended stable] Patch "md/raid10: Fix memory leak when raid10 reshape completes." has been added to staging queue

Kamal Mostafa kamal at canonical.com
Tue Sep 30 21:29:28 UTC 2014

This is a note to let you know that I have just added a patch titled

    md/raid10: Fix memory leak when raid10 reshape completes.

to the linux-3.13.y-queue branch of the 3.13.y.z extended stable tree 
which can be found at:


This patch is scheduled to be released in version

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y.z tree, see



>From 7ffce3c577cc8f409606000295160ef6a1954361 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Mon, 18 Aug 2014 13:59:50 +1000
Subject: md/raid10: Fix memory leak when raid10 reshape completes.

commit b39685526f46976bcd13aa08c82480092befa46c upstream.

When a raid10 commences a resync/recovery/reshape it allocates
some buffer space.
When a resync/recovery completes the buffer space is freed.  But not
when the reshape completes.
This can result in a small memory leak.

There is a subtle side-effect of this bug.  When a RAID10 is reshaped
to a larger array (more devices), the reshape is immediately followed
by a "resync" of the new space.  This "resync" will use the buffer
space which was allocated for "reshape".  This can cause problems
including a "BUG" in the SCSI layer.  So this is suitable for -stable.

Fixes: 3ea7daa5d7fde47cd41f4d56c2deb949114da9d6
Signed-off-by: NeilBrown <neilb at suse.de>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/md/raid10.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 4800e56..1b707ad 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2967,6 +2967,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
 		if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) {
+			close_sync(conf);
 			return 0;


More information about the kernel-team mailing list