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 2/3] FIX: Add error message in container_reshape()
Date: Tue, 13 Dec 2011 11:12:18 +0100	[thread overview]
Message-ID: <20111213101218.15703.22577.stgit@gklab-128-013.igk.intel.com> (raw)
In-Reply-To: <20111213101210.15703.14918.stgit@gklab-128-013.igk.intel.com>

Add proper error message for container reshape when device cannot be opened.
fd variable operation is moved down to display information what particular
device cannot be opened.

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

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

diff --git a/Grow.c b/Grow.c
index 1828f83..97f6973 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2538,15 +2538,19 @@ int reshape_container(char *container, char *devname,
 		if (!content)
 			break;
 
-		fd = open_dev(mdstat->devnum);
-		if (fd < 0)
-			break;
 		adev = map_dev(dev2major(mdstat->devnum),
 			       dev2minor(mdstat->devnum),
 			       0);
 		if (!adev)
 			adev = content->text_version;
 
+		fd = open_dev(mdstat->devnum);
+		if (fd < 0) {
+			printf(Name ": Device %s cannot be opened for reshape.",
+			       adev);
+			break;
+		}
+
 		if (last_devnum == mdstat->devnum) {
 			/* do not allow for reentry reshape_array()
 			 * for the same device. It can happen when resahpe_array


  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 ` Adam Kwolek [this message]
2011-12-13 10:12 ` [PATCH 3/3] imsm: FIX: return correct status from load_imsm_migr_rec() Adam Kwolek
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=20111213101218.15703.22577.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