linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Assemble-Resize-Stop loop doesn't work correctly
@ 2012-10-09 15:57 Sebastian Riemer
  2012-10-11  0:42 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Riemer @ 2012-10-09 15:57 UTC (permalink / raw)
  To: NeilBrown; +Cc: Linux RAID, Sebastian Riemer

Hi Neil,

I've tested with the following script grow with "--assume-clean" in a
loop. The first grow succeeds - following grows fail - mdadm 3.2.5,
kernel 3.4.10.


#!/bin/bash

FIRST="/dev/sda"
SECON="/dev/sdd"
MDDEV="/dev/md0"
SIZE=1

mdadm --zero-superblock $FIRST
mdadm --zero-superblock $SECON
echo y | mdadm -C $MDDEV -e 1.2 \
--assume-clean -z "${SIZE}G" --force -l 1 -n 2 $FIRST $SECON
sleep 3
mdadm -S $MDDEV
for ((i=0; i<4; i++)); do
  mdadm -A $MDDEV $FIRST $SECON
  let "SIZE++"
  mdadm -G $MDDEV -z ${SIZE}G --assume-clean
  cat /proc/mdstat
#  mdadm -D $MDDEV > /dev/null
  mdadm -S $MDDEV
done


Output looks like this:

mdadm: /dev/md0 has been started with 2 drives.
mdadm: component size of /dev/md0 has been set to 2097152K
Personalities : [raid1]
md0 : active raid1 sda[0] sdd[1]
      2097152 blocks super 1.2 [2/2] [UU]
     
unused devices: <none>
mdadm: stopped /dev/md0
mdadm: /dev/md0 has been started with 2 drives.
mdadm: /dev/md0 is performing resync/recovery and cannot be reshaped
Personalities : [raid1]
md0 : active raid1 sda[0] sdd[1]
      2097152 blocks super 1.2 [2/2] [UU]
      [==========>..........]  resync = 50.0% (1050624/2097152)
finish=8.4min speed=2048K/sec


Now the output with "Detail"-Mode after resize:

mdadm: /dev/md0 has been started with 2 drives.
mdadm: component size of /dev/md0 has been set to 2097152K
Personalities : [raid1]
md0 : active raid1 sda[0] sdd[1]
      2097152 blocks super 1.2 [2/2] [UU]
     
unused devices: <none>
mdadm: stopped /dev/md0
mdadm: /dev/md0 has been started with 2 drives.
mdadm: component size of /dev/md0 has been set to 3145728K
Personalities : [raid1]
md0 : active raid1 sda[0] sdd[1]
      3145728 blocks super 1.2 [2/2] [UU]


This one works. Is this wanted behaviour?

Cheers,
Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Assemble-Resize-Stop loop doesn't work correctly
  2012-10-09 15:57 Assemble-Resize-Stop loop doesn't work correctly Sebastian Riemer
@ 2012-10-11  0:42 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-10-11  0:42 UTC (permalink / raw)
  To: Sebastian Riemer; +Cc: Linux RAID

[-- Attachment #1: Type: text/plain, Size: 3263 bytes --]

On Tue, 09 Oct 2012 17:57:59 +0200 Sebastian Riemer
<sebastian.riemer@profitbricks.com> wrote:

> Hi Neil,
> 
> I've tested with the following script grow with "--assume-clean" in a
> loop. The first grow succeeds - following grows fail - mdadm 3.2.5,
> kernel 3.4.10.
> 
> 
> #!/bin/bash
> 
> FIRST="/dev/sda"
> SECON="/dev/sdd"
> MDDEV="/dev/md0"
> SIZE=1
> 
> mdadm --zero-superblock $FIRST
> mdadm --zero-superblock $SECON
> echo y | mdadm -C $MDDEV -e 1.2 \
> --assume-clean -z "${SIZE}G" --force -l 1 -n 2 $FIRST $SECON
> sleep 3
> mdadm -S $MDDEV
> for ((i=0; i<4; i++)); do
>   mdadm -A $MDDEV $FIRST $SECON
>   let "SIZE++"
>   mdadm -G $MDDEV -z ${SIZE}G --assume-clean
>   cat /proc/mdstat
> #  mdadm -D $MDDEV > /dev/null
>   mdadm -S $MDDEV
> done
> 
> 
> Output looks like this:
> 
> mdadm: /dev/md0 has been started with 2 drives.
> mdadm: component size of /dev/md0 has been set to 2097152K
> Personalities : [raid1]
> md0 : active raid1 sda[0] sdd[1]
>       2097152 blocks super 1.2 [2/2] [UU]
>      
> unused devices: <none>
> mdadm: stopped /dev/md0
> mdadm: /dev/md0 has been started with 2 drives.
> mdadm: /dev/md0 is performing resync/recovery and cannot be reshaped
> Personalities : [raid1]
> md0 : active raid1 sda[0] sdd[1]
>       2097152 blocks super 1.2 [2/2] [UU]
>       [==========>..........]  resync = 50.0% (1050624/2097152)
> finish=8.4min speed=2048K/sec
> 
> 
> Now the output with "Detail"-Mode after resize:
> 
> mdadm: /dev/md0 has been started with 2 drives.
> mdadm: component size of /dev/md0 has been set to 2097152K
> Personalities : [raid1]
> md0 : active raid1 sda[0] sdd[1]
>       2097152 blocks super 1.2 [2/2] [UU]
>      
> unused devices: <none>
> mdadm: stopped /dev/md0
> mdadm: /dev/md0 has been started with 2 drives.
> mdadm: component size of /dev/md0 has been set to 3145728K
> Personalities : [raid1]
> md0 : active raid1 sda[0] sdd[1]
>       3145728 blocks super 1.2 [2/2] [UU]
> 
> 
> This one works. Is this wanted behaviour?
> 
> Cheers,
> Sebastian


You've hit an unlikely corner-case there.  Thanks.

This patch fixes it.

NeilBrown

From 2225a657ce9fb4a5390a4a82c03e6a0f937b4327 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 11 Oct 2012 11:41:14 +1100
Subject: [PATCH] md: make sure manual changes to recovery checkpoint are
 saved.

If you make an array bigger but suppress resync of the new region with
  mdadm --grow /dev/mdX --size=max --assume-clean

then stop the array before anything is written to it, the effect of
the "--assume-clean" is lost and the array will resync the new space
when restarted.
So ensure that we update the metadata in the case.

Reported-by: Sebastian Riemer <sebastian.riemer@profitbricks.com>
Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/drivers/md/md.c b/drivers/md/md.c
index e868f0c..dff013a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3819,6 +3819,8 @@ resync_start_store(struct mddev *mddev, const char *buf, size_t len)
 		return -EINVAL;
 
 	mddev->recovery_cp = n;
+	if (mddev->pers)
+		set_bit(MD_CHANGE_CLEAN, &mddev->flags);
 	return len;
 }
 static struct md_sysfs_entry md_resync_start =

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-11  0:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-09 15:57 Assemble-Resize-Stop loop doesn't work correctly Sebastian Riemer
2012-10-11  0:42 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).