linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org,
	Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Subject: [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape"
Date: Wed, 23 Dec 2015 12:57:11 +0100	[thread overview]
Message-ID: <1450871831-25452-2-git-send-email-artur.paszkiewicz@intel.com> (raw)
In-Reply-To: <1450871831-25452-1-git-send-email-artur.paszkiewicz@intel.com>

When reshape was interrupted, an incorrect checkpoint would be saved in
the migration record. Change wait_for_reshape_imsm() to return -1 when
sync_action is not "reshape" to abort early in imsm_manage_reshape()
without writing the migration record.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
 super-intel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index e609e0c..c7efa98 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10300,8 +10300,10 @@ int wait_for_reshape_imsm(struct mdinfo *sra, int ndata)
 		sysfs_wait(fd, NULL);
 		if (sysfs_get_str(sra, NULL, "sync_action",
 				  action, 20) > 0 &&
-				strncmp(action, "reshape", 7) != 0)
-			break;
+				strncmp(action, "reshape", 7) != 0) {
+			close(fd);
+			return -1;
+		}
 		if (sysfs_fd_get_ll(fd, &completed) < 0) {
 			dprintf("cannot read reshape_position (in loop)\n");
 			close(fd);
-- 
2.1.4


  reply	other threads:[~2015-12-23 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 11:57 [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping Artur Paszkiewicz
2015-12-23 11:57 ` Artur Paszkiewicz [this message]
2015-12-23 23:04   ` [PATCH 2/2] imsm: abort reshape if sync_action is not "reshape" NeilBrown
2015-12-23 23:00 ` [PATCH 1/2] Grow: close file descriptor earlier to avoid "still in use" when stopping 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=1450871831-25452-2-git-send-email-artur.paszkiewicz@intel.com \
    --to=artur.paszkiewicz@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).