All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Kwolek <adam.kwolek@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
	ed.ciechanowski@intel.com, wojciech.neubauer@intel.com
Subject: [PATCH 2/4] imsm: FIX: spare cannot be added
Date: Thu, 20 Jan 2011 11:57:30 +0100	[thread overview]
Message-ID: <20110120105730.22926.93231.stgit@gklab-128-013.igk.intel.com> (raw)
In-Reply-To: <20110120104759.22926.66874.stgit@gklab-128-013.igk.intel.com>

When Manage.c adds spare, it calls write_init_super() and this function
is responsible for closing disk handle (Manage.c:812).
For imsm case this handle is reused for managing this disk and handle
(due to this it is not closed).
As handle was opened with flag O_EXCL, adding disk to md fails on writing
to new_dev (md cannot set lock on device).
To resolve situation close current handle and open new one without O_EXCL flag.

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 super-intel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 7f907ef..0d6d2ee 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3714,6 +3714,7 @@ static int mgmt_disk(struct supertype *st)
 	struct intel_super *super = st->sb;
 	size_t len;
 	struct imsm_update_add_remove_disk *u;
+	struct dl *d;
 
 	if (!super->disk_mgmt_list)
 		return 0;
@@ -3729,6 +3730,14 @@ static int mgmt_disk(struct supertype *st)
 	u->type = update_add_remove_disk;
 	append_metadata_update(st, u, len);
 
+	for (d = super->disk_mgmt_list; d ; d = d->next) {
+		char buf[PATH_MAX];
+
+		close(d->fd);
+		sprintf(buf, "%d:%d", d->major, d->minor);
+		d->fd = dev_open(buf, O_RDWR | O_DIRECT);
+	}
+
 	return 0;
 }
 


  parent reply	other threads:[~2011-01-20 10:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20 10:57 [PATCH 0/4] OLCE continue reshape for all arrays in container (rebased) Adam Kwolek
2011-01-20 10:57 ` [PATCH 1/4] imsm: Update metadata for second array Adam Kwolek
2011-01-26  5:33   ` Neil Brown
2011-01-20 10:57 ` Adam Kwolek [this message]
2011-01-27  3:02   ` [PATCH 2/4] imsm: FIX: spare cannot be added Neil Brown
2011-01-27  7:59     ` Kwolek, Adam
2011-01-20 10:57 ` [PATCH 3/4] FIX: monitor doesn't handshake with md Adam Kwolek
2011-01-27  3:03   ` Neil Brown
2011-01-27  7:57     ` Kwolek, Adam
2011-01-20 10:57 ` [PATCH 4/4] WORKAROUND: mdadm hangs during reshape Adam Kwolek
2011-01-27  3:05   ` Neil Brown

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=20110120105730.22926.93231.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=neilb@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.