Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, ed.ciechanowski@intel.com,
	marcin.labun@intel.com, dan.j.williams@intel.com
Subject: [PATCH 3/3] imsm: FIX: return correct status from load_imsm_migr_rec()
Date: Tue, 13 Dec 2011 11:12:26 +0100	[thread overview]
Message-ID: <20111213101226.15703.61859.stgit@gklab-128-013.igk.intel.com> (raw)
In-Reply-To: <20111213101210.15703.14918.stgit@gklab-128-013.igk.intel.com>

load_imsm_migr_rec() should see difference between no migration record due
to no migration in progress and loading migration record error.
Additional return value (-2) was introduced to this function.

Using new status load_super_imsm_all() can correctly check loading
migration record status.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 super-intel.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index e8e21f4..3a34f5a 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2120,6 +2120,7 @@ static struct imsm_dev *imsm_get_device_during_migration(
  * Returns:
  *	 0 : success
  *	-1 : fail
+ *	-2 : no migration in progress
  ******************************************************************************/
 static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
 {
@@ -2137,7 +2138,7 @@ static int load_imsm_migr_rec(struct intel_super *super, struct mdinfo *info)
 	/* nothing to load,no migration in progress?
 	*/
 	if (dev == NULL)
-		return 0;
+		return -2;
 	map = get_imsm_map(dev, MAP_0);
 
 	if (info) {
@@ -4079,13 +4080,16 @@ static int load_super_imsm_all(struct supertype *st, int fd, void **sbp,
 
 	/* load migration record */
 	err = load_imsm_migr_rec(super, NULL);
-	if (err) {
+	if (err == -1) {
+		/* migration is in progress,
+		 * but migr_rec cannot be loaded,
+		 */
 		err = 4;
 		goto error;
 	}
 
 	/* Check migration compatibility */
-	if (check_mpb_migr_compatibility(super) != 0) {
+	if ((err == 0) && (check_mpb_migr_compatibility(super) != 0)) {
 		fprintf(stderr, Name ": Unsupported migration detected");
 		if (devname)
 			fprintf(stderr, " on %s\n", devname);


  parent reply	other threads:[~2011-12-13 10:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 10:12 [PATCH 1/3] FIX: Do not allow for multiple reshape_array() execution during reshape_container() call Adam Kwolek
2011-12-13 10:12 ` [PATCH 2/3] FIX: Add error message in container_reshape() Adam Kwolek
2011-12-13 10:12 ` Adam Kwolek [this message]
2011-12-14  8:08 ` [PATCH 1/3] FIX: Do not allow for multiple reshape_array() execution during reshape_container() call NeilBrown
2011-12-14  8:19   ` Kwolek, Adam

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=20111213101226.15703.61859.stgit@gklab-128-013.igk.intel.com \
    --to=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 \
    --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