From: Neil Brown <neilb@suse.de>
To: Krzysztof Wojcik <krzysztof.wojcik@intel.com>
Cc: linux-raid@vger.kernel.org, wojciech.neubauer@intel.com,
adam.kwolek@intel.com, dan.j.williams@intel.com,
ed.ciechanowski@intel.com
Subject: Re: [PATCH 13/13] External reshape (step 2): Freeze container
Date: Tue, 23 Nov 2010 17:11:25 +1100 [thread overview]
Message-ID: <20101123171125.0e71f3f1@notabene.brown> (raw)
In-Reply-To: <20101118092308.29508.21225.stgit@gklab-170-111.igk.intel.com>
On Thu, 18 Nov 2010 10:23:08 +0100
Krzysztof Wojcik <krzysztof.wojcik@intel.com> wrote:
> From: Dan Williams <dan.j.williams@intel.com>
>
> When growing the number of raid disks the reshape process will promote
> container-spares to subarray-spares (later the kernel promotes them to
> subarray-members in raid5_start_reshape()). The automatic spare
> promotion that mdmon performs upon seeing a degraded array must be
> disabled until the reshape process has been initiated. Otherwise, mdmon
> may start a rebuild before the reshape parameters can be specified.
>
> In the external case we arrange for the monitor to be blocked, and turn off the safemode delay.
> Mdmon is updated to check sync_action is not frozen before initiating
> recovery. This introduces a need to check which version of mdmon is
> running to be sure it honors the expected semantics. Extend
> ping_monitor() to report the version of mdmon. This also permits
> discrimination of known buggy mdmon implementations in the future.
> Note, it's not enough to know the current version of mdadm because the
> mdmon instance may have originated from the initrd, so there is no
> guaratee that mdadm and mdmon versions are synchronized.
I have applied this, and all the others that I didn't raise explicit issues
with (which I think was only
[PATCH 07/13] Grow: add missing raid4 geometries to geo_map()
and I have pushed out a new devel-3.2
Thanks,
NeilBrown
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> Grow.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------
> 1 files changed, 69 insertions(+), 19 deletions(-)
>
> diff --git a/Grow.c b/Grow.c
> index 59032ef..4139265 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -432,29 +432,78 @@ static int child_same_size(int afd, struct mdinfo *sra, unsigned long blocks,
> int disks, int chunk, int level, int layout, int data,
> int dests, int *destfd, unsigned long long *destoffsets);
>
> -static int freeze_array(struct mdinfo *sra)
> +static int freeze_container(struct supertype *st)
> {
> - /* Try to freeze resync on this array.
> + int container_dev = st->subarray[0] ? st->container_dev : st->devnum;
> + char *container = devnum2devname(container_dev);
> +
> + if (!container) {
> + fprintf(stderr, Name
> + ": could not determine container name, freeze aborted\n");
> + return -2;
> + }
> +
> + if (block_monitor(container, 1)) {
> + fprintf(stderr, Name ": failed to freeze container\n");
> + return -2;
> + }
> +
> + return 1;
> +}
> +
> +static void unfreeze_container(struct supertype *st)
> +{
> + int container_dev = st->subarray[0] ? st->container_dev : st->devnum;
> + char *container = devnum2devname(container_dev);
> +
> + if (!container) {
> + fprintf(stderr, Name
> + ": could not determine container name, unfreeze aborted\n");
> + return;
> + }
> +
> + unblock_monitor(container, 1);
> +}
> +
> +static int freeze(struct supertype *st)
> +{
> + /* Try to freeze resync/rebuild on this array/container.
> * Return -1 if the array is busy,
> + * return -2 container cannot be frozen,
> * return 0 if this kernel doesn't support 'frozen'
> * return 1 if it worked.
> */
> - char buf[20];
> - if (sysfs_get_str(sra, NULL, "sync_action", buf, 20) <= 0)
> - return 0;
> - if (strcmp(buf, "idle\n") != 0 &&
> - strcmp(buf, "frozen\n") != 0)
> - return -1;
> - if (sysfs_set_str(sra, NULL, "sync_action", "frozen") < 0)
> - return 0;
> - return 1;
> + if (st->ss->external)
> + return freeze_container(st);
> + else {
> + struct mdinfo *sra = sysfs_read(-1, st->devnum, GET_VERSION);
> + int err;
> +
> + if (!sra)
> + return -1;
> + err = sysfs_freeze_array(sra);
> + sysfs_free(sra);
> + return err;
> + }
> }
>
> -static void unfreeze_array(struct mdinfo *sra, int frozen)
> +static void unfreeze(struct supertype *st, int frozen)
> {
> /* If 'frozen' is 1, unfreeze the array */
> - if (frozen > 0)
> - sysfs_set_str(sra, NULL, "sync_action", "idle");
> + if (frozen <= 0)
> + return;
> +
> + if (st->ss->external)
> + return unfreeze_container(st);
> + else {
> + struct mdinfo *sra = sysfs_read(-1, st->devnum, GET_VERSION);
> +
> + if (sra)
> + sysfs_set_str(sra, NULL, "sync_action", "idle");
> + else
> + fprintf(stderr, Name ": failed to unfreeze array\n");
> + sysfs_free(sra);
> + }
> }
>
> static void wait_reshape(struct mdinfo *sra)
> @@ -818,19 +867,21 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
> array.level = LEVEL_CONTAINER;
> sra->array.level = LEVEL_CONTAINER;
> }
> - frozen = freeze_array(sra);
> } else {
> fprintf(stderr, Name ": failed to read sysfs parameters for %s\n",
> devname);
> return 1;
> }
> - if (frozen < 0) {
> + frozen = freeze(st);
> + if (frozen < -1) {
> + /* freeze() already spewed the reason */
> + return 1;
> + } else if (frozen < 0) {
> fprintf(stderr, Name ": %s is performing resync/recovery and cannot"
> " be reshaped\n", devname);
> return 1;
> }
>
> -
> /* ========= set size =============== */
> if (size >= 0 && (size == 0 || size != array.size)) {
> long long orig_size = array.size;
> @@ -1611,8 +1662,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
> if (c && sysfs_set_str(sra, NULL, "level", c) == 0)
> fprintf(stderr, Name ": aborting level change\n");
> }
> - if (sra)
> - unfreeze_array(sra, frozen);
> + unfreeze(st, frozen);
> return rv;
> }
>
prev parent reply other threads:[~2010-11-23 6:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-18 9:21 [PATCH 00/13] Series short description Krzysztof Wojcik
2010-11-18 9:21 ` [PATCH 01/13] Provide a mdstat_ent to subarray helper Krzysztof Wojcik
2010-11-18 9:21 ` [PATCH 02/13] block monitor: freeze spare assignment for external arrays Krzysztof Wojcik
2010-11-23 4:03 ` Neil Brown
2010-11-18 9:21 ` [PATCH 03/13] Manage: allow manual control of external raid0 readonly flag Krzysztof Wojcik
2010-11-23 4:08 ` Neil Brown
2010-11-18 9:21 ` [PATCH 04/13] Grow: mark some functions static Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 05/13] Assemble: fix assembly in the delta_disks > max_degraded case Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 06/13] Grow: fix check for raid6 layout normalization Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 07/13] Grow: add missing raid4 geometries to geo_map() Krzysztof Wojcik
2010-11-23 4:16 ` Neil Brown
2010-11-18 9:22 ` [PATCH 08/13] fix a get_linux_version() comparison typo Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 09/13] Create: cleanup/unify default geometry handling Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 10/13] Initialize st->devnum and st->container_dev in super_by_fd Krzysztof Wojcik
2010-11-18 9:22 ` [PATCH 11/13] Document the external reshape implementation Krzysztof Wojcik
2010-11-23 4:52 ` Neil Brown
2010-11-18 9:22 ` [PATCH 12/13] External reshape (step 1): container reshape and ->reshape_super() Krzysztof Wojcik
2010-11-23 5:22 ` Neil Brown
2010-11-18 9:23 ` [PATCH 13/13] External reshape (step 2): Freeze container Krzysztof Wojcik
2010-11-23 6:11 ` Neil Brown [this message]
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=20101123171125.0e71f3f1@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=krzysztof.wojcik@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=wojciech.neubauer@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).