Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Neil Brown <neilb@suse.de>
Cc: "Neubauer, Wojciech" <Wojciech.Neubauer@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	"Ciechanowski, Ed" <ed.ciechanowski@intel.com>,
	"Hawrylewicz Czarnowski,
	Przemyslaw" <przemyslaw.hawrylewicz.czarnowski@intel.com>,
	"Labun, Marcin" <Marcin.Labun@intel.com>,
	linux-raid <linux-raid@vger.kernel.org>,
	"Jiang, Dave" <dave.jiang@intel.com>
Subject: Re: fixes for 3.1.3 (was: Re: [mdadm GIT PULL] rebuild checkpoints...)
Date: Wed, 21 Jul 2010 11:04:04 -0700	[thread overview]
Message-ID: <1279735444.25713.9.camel@dwillia2-linux> (raw)
In-Reply-To: <1278445909.3949.11.camel@dwillia2-linux>

On Tue, 2010-07-06 at 12:51 -0700, Williams, Dan J wrote:
> On Mon, 2010-07-05 at 21:50 -0700, Neil Brown wrote:
> > I'm fairly seriously considering cutting a 3.1.3 shortly (Thursday?) so that
> > I have a clean slate to build the policy frame work and aim it for 3.2.0.
> > 
> > If you have anything that you would like to see included in (or addressed
> > for) 3.1.3, please let me know.
> > 
> 
> The pthread_create() vs clone(2) issue is still being discussed, but in
> the meantime using pthreads seems the safe thing to do.  So, here is
> that implementation and another trivial build-warning fixup.
> 

I've appended a patch to repair external metadata incremental assembly
that was broken by commit 3a6ec29a "Don't let incremental add devices to
active arrays."  So the pull request is now:

The following changes since commit 50526e9090d0c118b065840719bc9601be8af8b8:
  NeilBrown (1):
        super-0.90: don't write bitmap larger than 60K

are available in the git repository at:

  git://github.com/djbw/mdadm.git master

Dan Williams (3):
      mdmon: satisfy glibc tls abi requirements with pthreads
      imsm: fix a -O2 build warning
      Incremental: restore assembly for inactive containers, block active

 Incremental.c |   11 ++++++++++-
 Makefile      |   14 +++++++++++---
 mdadm.h       |    1 +
 mdmon.c       |   42 +++++++++++++++++++++++++++++++++++++++---
 super-intel.c |    4 ++--
 util.c        |    7 ++++++-
 6 files changed, 69 insertions(+), 10 deletions(-)


---
Incremental: restore assembly for inactive containers, block active

GET_ARRAY_INFO always succeeds on an inactive container, so we need to
be a bit more diligent about adding a disk to an active container.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---

 Incremental.c |   11 ++++++++++-
 mdadm.h       |    1 +
 util.c        |    7 ++++++-
 3 files changed, 17 insertions(+), 2 deletions(-)


diff --git a/Incremental.c b/Incremental.c
index 96bfcec..abfea24 100644
--- a/Incremental.c
+++ b/Incremental.c
@@ -376,7 +376,16 @@ int Incremental(char *devname, int verbose, int runstop,
 		 * statement about this.
 		 */
 		if (runstop < 1) {
-			if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0) {
+			int active = 0;
+			
+			if (st->ss->external) {
+				char *devname = devnum2devname(fd2devnum(mdfd));
+
+				active = devname && is_container_active(devname);
+				free(devname);
+			} else if (ioctl(mdfd, GET_ARRAY_INFO, &ainf) == 0)
+				active = 1;
+			if (active) {
 				fprintf(stderr, Name
 					": not adding %s to active array (without --run) %s\n",
 					devname, chosen_name);
diff --git a/mdadm.h b/mdadm.h
index 55e9e46..f1fe24f 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -930,6 +930,7 @@ extern int open_mddev(char *dev, int report_errors);
 extern int open_container(int fd);
 extern int is_container_member(struct mdstat_ent *ent, char *devname);
 extern int is_subarray_active(char *subarray, char *devname);
+int is_container_active(char *devname);
 extern int open_subarray(char *dev, struct supertype *st, int quiet);
 extern struct superswitch *version_to_superswitch(char *vers);
 
diff --git a/util.c b/util.c
index d22b0d0..1ce6a7a 100644
--- a/util.c
+++ b/util.c
@@ -1427,7 +1427,7 @@ int is_subarray_active(char *subarray, char *container)
 		if (is_container_member(ent, container)) {
 			char *inst = &ent->metadata_version[10+strlen(container)+1];
 
-			if (strcmp(inst, subarray) == 0)
+			if (!subarray || strcmp(inst, subarray) == 0)
 				break;
 		}
 	}
@@ -1437,6 +1437,11 @@ int is_subarray_active(char *subarray, char *container)
 	return ent != NULL;
 }
 
+int is_container_active(char *container)
+{
+	return is_subarray_active(NULL, container);
+}
+
 /* open_subarray - opens a subarray in a container
  * @dev: container device name
  * @st: supertype with only ->subarray set



  reply	other threads:[~2010-07-21 18:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27  0:50 [mdadm GIT PULL] rebuild checkpoints, incremental assembly, volume delete/rename, and fixes Dan Williams
2010-05-31  1:37 ` Neil Brown
2010-06-11  6:42   ` Dan Williams
2010-06-16  6:33     ` Neil Brown
2010-07-02  0:56       ` Dan Williams
2010-07-06  4:50         ` Neil Brown
2010-07-06 19:51           ` fixes for 3.1.3 (was: Re: [mdadm GIT PULL] rebuild checkpoints...) Dan Williams
2010-07-21 18:04             ` Dan Williams [this message]
2010-07-22  7:47               ` Neil Brown
2010-07-06 21:43           ` [mdadm GIT PULL] rebuild checkpoints, incremental assembly, volume delete/rename, and fixes Doug Ledford
2010-07-06 22:17             ` Neil Brown
2010-07-07 14:03               ` Doug Ledford
2010-07-08  7:50                 ` 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=1279735444.25713.9.camel@dwillia2-linux \
    --to=dan.j.williams@intel.com \
    --cc=Marcin.Labun@intel.com \
    --cc=Wojciech.Neubauer@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dledford@redhat.com \
    --cc=ed.ciechanowski@intel.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=przemyslaw.hawrylewicz.czarnowski@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