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, dan.j.williams@intel.com
Subject: Re: [PATCH 6/8] Verify reshape restart position
Date: Mon, 3 Oct 2011 10:06:28 +1100 [thread overview]
Message-ID: <20111003100628.3e09e24c@notabene.brown> (raw)
In-Reply-To: <20110927120522.4890.83002.stgit@gklab-128-013.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2409 bytes --]
On Tue, 27 Sep 2011 14:05:22 +0200 Adam Kwolek <adam.kwolek@intel.com> wrote:
> Check if reshape restart position is the same as set in md.
> If position doesn't match this means that we cannot restart reshape.
>
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
>
> Grow.c | 32 ++++++++++++++++++++++++++++++++
> 1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/Grow.c b/Grow.c
> index afe4c72..3ff249d 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -3653,6 +3653,8 @@ int Grow_continue_command(char *devname, int fd,
> char buf[40];
> int cfd = -1;
> int fd2 = -1;
> + char *ep;
> + unsigned long long position;
>
> dprintf("Grow continue from command line called for %s\n",
> devname);
> @@ -3754,6 +3756,36 @@ int Grow_continue_command(char *devname, int fd,
> }
> }
>
> + /* verify that array under reshape is started from
> + * correct position
> + */
> + ret_val = sysfs_get_str(content, NULL, "sync_max", buf, 40);
> + if (ret_val <= 0) {
> + fprintf(stderr, Name
> + ": cannot open verify reshape progress for %s (%i)\n",
> + content->sys_name, ret_val);
> + ret_val = 1;
> + goto Grow_continue_command_exit;
> + }
> + dprintf(Name ": Read sync_max sysfs entry is: %s\n", buf);
> + errno = 0;
> + position = strtoull(buf, &ep, 0);
> + if (errno || ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' ')) {
> + fprintf(stderr, Name ": md is not allowed to finish reshape "
> + "wihout mdadm assistance.\n");
> + ret_val = 1;
> + goto Grow_continue_command_exit;
> + }
> + position *= get_data_disks(map_name(pers, mdstat->level),
> + content->new_layout,
> + content->array.raid_disks);
> + if (position != content->reshape_progress) {
> + fprintf(stderr, Name ": md is not allowed to finish reshape "
> + "wihout mdadm assistance.\n");
> + ret_val = 1;
> + goto Grow_continue_command_exit;
> + }
> +
> /* continue reshape
> */
> ret_val = Grow_continue(fd, st, content, backup_file,
Applied with a few small changes.
1/ is it never correct to test errno to see if an error occurred. You must
test something else to see if an error occurred, and the check errno to
see what the error was.
2/ The error message didn't seem helpful. I changed it to:
Fatal error: array reshape was not properly frozen.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
next prev parent reply other threads:[~2011-10-02 23:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 12:04 [PATCH 0/8] Reshape restart after filesystem pivot Adam Kwolek
2011-09-27 12:04 ` [PATCH 1/8] Do not continue reshape during initrd phase Adam Kwolek
2011-10-02 22:19 ` NeilBrown
2011-09-27 12:04 ` [PATCH 2/8] Add continue option to grow command Adam Kwolek
2011-10-02 22:27 ` NeilBrown
2011-09-27 12:04 ` [PATCH 3/8] Do not restart reshape if it is started already Adam Kwolek
2011-10-02 22:41 ` NeilBrown
2011-09-27 12:05 ` [PATCH 4/8] Set correct reshape restart position Adam Kwolek
2011-10-02 22:56 ` NeilBrown
2011-09-27 12:05 ` [PATCH 5/8] Move code to get_data_disks() function Adam Kwolek
2011-10-02 22:58 ` NeilBrown
2011-09-27 12:05 ` [PATCH 6/8] Verify reshape restart position Adam Kwolek
2011-10-02 23:06 ` NeilBrown [this message]
2011-09-27 12:05 ` [PATCH 7/8] Manual update for --continue option Adam Kwolek
2011-09-27 12:05 ` [PATCH 8/8] " Adam Kwolek
2011-10-02 23:09 ` NeilBrown
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=20111003100628.3e09e24c@notabene.brown \
--to=neilb@suse.de \
--cc=adam.kwolek@intel.com \
--cc=dan.j.williams@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).