From: NeilBrown <neilb@suse.de>
To: Adam Kwolek <adam.kwolek@intel.com>
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
marcin.labun@intel.com
Subject: Re: [PATCH 01/14] Stop array reshape when mounted initramfs is detected
Date: Mon, 19 Sep 2011 20:42:20 +1000 [thread overview]
Message-ID: <20110919204220.2a2418a5@notabene.brown> (raw)
In-Reply-To: <20110916115354.5201.38688.stgit@gklab-128-013.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 4530 bytes --]
On Fri, 16 Sep 2011 13:53:54 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:
> During remounting file system from initramfs to real one,
> mdadm is not able to continue reshape procedure due to lost
> filesystem context.
> To avoid this mdadm detects mounted initramfs and performs
> critical section restore only. Array is set for later
> reshape continuation.
>
> Reshape continuation will be possible to invoking manually,
> using '--continue' option.
>
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
>
> Grow.c | 25 +++++++++++++++++++++++--
> mdadm.h | 4 ++++
> util.c | 22 ++++++++++++++++++++++
> 3 files changed, 49 insertions(+), 2 deletions(-)
>
> diff --git a/Grow.c b/Grow.c
> index 17d14b6..420177c 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -635,10 +635,21 @@ static int subarray_set_num(char *container, struct mdinfo *sra, char *name, int
> return rc;
> }
>
> +/* possible return values:
> + * 0 : success
> + * -1: error
> + * INITRAMFS_IS_IN_USE: continue reshape later
> + */
> int start_reshape(struct mdinfo *sra, int already_running)
> {
> int err;
> - sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
> +
> + /* do not block array as we not continue reshape this time
> + */
> + if (initramfs_is_in_use() == INITRAMFS_NOT_USED)
> + sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL);
> + else
> + sysfs_set_num(sra, NULL, "suspend_lo", 0);
> err = sysfs_set_num(sra, NULL, "suspend_hi", 0);
> err = err ?: sysfs_set_num(sra, NULL, "suspend_lo", 0);
> if (!already_running)
> @@ -2190,6 +2201,14 @@ started:
> }
> if (restart)
> sysfs_set_str(sra, NULL, "array_state", "active");
> + if (initramfs_is_in_use() == INITRAMFS_IS_IN_USE) {
> + free(fdlist);
> + free(offsets);
> + sysfs_free(sra);
> + fprintf(stderr, Name ": Reshape has to be continued "
> + "when root fileststem will be mounted\n");
> + return 1;
> + }
>
> /* Now we just need to kick off the reshape and watch, while
> * handling backups of the data...
> @@ -2357,7 +2376,9 @@ int reshape_container(char *container, char *devname,
> unfreeze(st);
> return 1;
> default: /* parent */
> - printf(Name ": multi-array reshape continues in background\n");
> + if (initramfs_is_in_use() == INITRAMFS_NOT_USED)
> + printf(Name ": multi-array reshape continues "
> + "in background\n");
> return 0;
> case 0: /* child */
> break;
> diff --git a/mdadm.h b/mdadm.h
> index d616966..9035e67 100644
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -1161,6 +1161,10 @@ extern char *human_size(long long bytes);
> extern char *human_size_brief(long long bytes);
> extern void print_r10_layout(int layout);
>
> +extern int initramfs_is_in_use(void);
> +#define INITRAMFS_IS_IN_USE 1
> +#define INITRAMFS_NOT_USED 0
> +
> #define NoMdDev (1<<23)
> extern int find_free_devnum(int use_partitions);
>
> diff --git a/util.c b/util.c
> index 0ea7e0d..7186f3f 100644
> --- a/util.c
> +++ b/util.c
> @@ -1768,3 +1768,25 @@ struct mdinfo *container_choose_spares(struct supertype *st,
> }
> return disks;
> }
> +
> +int initramfs_is_in_use(void)
> +{
> + int ret_val;
> + struct stat sts;
> +
> + /* /init
> + * common script for many Linux distribution
> + * /sysboot
> + * is specific for RH
> + * /mkinitrd.config
> + * is specific for SLES
> + */
> + if ((stat("/init", &sts) == -1) ||
> + ((stat("/sysroot", &sts) == -1) &&
> + (stat("/mkinitrd.config", &sts) == -1)))
> + ret_val = INITRAMFS_NOT_USED;
> + else
> + ret_val = INITRAMFS_IS_IN_USE;
> +
> + return ret_val;
> +}
>
Hi,
I meant to look through this today but didn't manage to get to it.
However an easy comment is that this initramfs_is_in_use is not acceptable.
You are measuring symptoms and not the cause.
Unfortunately it isn't really easy to measure "Is someone likely to want to
replace the current root filesystem with a different one soon".
In the first instance I think this should be implemented as a command line
option: --freeze-reshape maybe. It is understood with --assemble to mean
that any reshape should not be continued.
It should be possible to get that into the mdadm flags during initrd but not
in the root filesystem.
The second patch looks like it should be combined with the first.
The rest seems OK at a first glance but I'll need to review it more carefully.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
next prev parent reply other threads:[~2011-09-19 10:42 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 11:53 [PATCH 00/14] Series short description Adam Kwolek
2011-09-16 11:53 ` [PATCH 01/14] Stop array reshape when mounted initramfs is detected Adam Kwolek
2011-09-19 10:42 ` NeilBrown [this message]
2011-09-19 11:14 ` Kwolek, Adam
2011-09-16 11:54 ` [PATCH 02/14] Stop container reshape while using initramfs Adam Kwolek
2011-09-16 11:54 ` [PATCH 03/14] FIX: Do not unblock array accidentally Adam Kwolek
2011-09-21 2:19 ` NeilBrown
2011-09-16 11:54 ` [PATCH 04/14] Add continue option to grow command Adam Kwolek
2011-09-21 2:22 ` NeilBrown
2011-09-21 7:47 ` Kwolek, Adam
2011-09-16 11:54 ` [PATCH 05/14] Add Grow_continue_command Adam Kwolek
2011-09-16 11:54 ` [PATCH 06/14] Check and run mdmon Adam Kwolek
2011-09-16 11:54 ` [PATCH 07/14] FIX: Memory leak during Assembly Adam Kwolek
2011-09-21 2:23 ` NeilBrown
2011-09-16 11:54 ` [PATCH 08/14] Check if reshape can be restarted Adam Kwolek
2011-09-21 2:27 ` NeilBrown
2011-09-21 7:45 ` Kwolek, Adam
2011-09-16 11:54 ` [PATCH 09/14] Move restore backup code to function Adam Kwolek
2011-09-21 2:28 ` NeilBrown
2011-09-16 11:55 ` [PATCH 10/14] Perform restore backup for reshape continuation Adam Kwolek
2011-09-21 2:29 ` NeilBrown
2011-09-21 7:35 ` Kwolek, Adam
2011-09-16 11:55 ` [PATCH 11/14] Add possibility to restart reshape for native metadata Adam Kwolek
2011-09-16 11:55 ` [PATCH 12/14] Early reshape backup verification Adam Kwolek
2011-09-21 2:31 ` NeilBrown
2011-09-21 7:33 ` Kwolek, Adam
2011-09-16 11:55 ` [PATCH 13/14] Check if md allows to control reshape Adam Kwolek
2011-09-21 2:33 ` NeilBrown
2011-09-21 7:31 ` Kwolek, Adam
2011-09-21 7:51 ` NeilBrown
2011-09-16 11:55 ` [PATCH 14/14] Manual update for --continue option Adam Kwolek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110919204220.2a2418a5@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=marcin.labun@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).