From: Dan Williams <dan.j.williams@intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, krzysztof.wojcik@intel.com,
ed.ciechanowski@intel.com, maciej.patelczyk@intel.com
Subject: [mdadm PATCH 07/12] imsm: add --update=uuid support
Date: Tue, 13 Oct 2009 19:10:51 -0700 [thread overview]
Message-ID: <20091014021051.31570.54396.stgit@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20091014020739.31570.36408.stgit@dwillia2-linux.ch.intel.com>
When disks have conflicting container memberships (same container ids
but incompatible member arrays) --update=uuid can be used to move
offenders to a new container id by changing 'orig_family_num'.
Note that this only supports random updates of the uuid as the actual
uuid is synthesized. We also need to communicate the new
'orig_family_num' value to all disks involved in the update. A new
field 'update_private' is added to struct mdinfo to allow this
information to be transmitted.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
Assemble.c | 3 +++
mdadm.h | 5 +++++
super-intel.c | 51 +++++++++++++++++++++++++++++++++++++++------------
3 files changed, 47 insertions(+), 12 deletions(-)
diff --git a/Assemble.c b/Assemble.c
index 4578906..7da0905 100644
--- a/Assemble.c
+++ b/Assemble.c
@@ -565,6 +565,7 @@ int Assemble(struct supertype *st, char *mddev,
#endif
/* Ok, no bad inconsistancy, we can try updating etc */
bitmap_done = 0;
+ content->update_private = NULL;
for (tmpdev = devlist; tmpdev; tmpdev=tmpdev->next) if (tmpdev->used == 1) {
char *devname = tmpdev->devname;
struct stat stb;
@@ -717,6 +718,8 @@ int Assemble(struct supertype *st, char *mddev,
}
devcnt++;
}
+ free(content->update_private);
+ content->update_private = NULL;
if (devcnt == 0) {
fprintf(stderr, Name ": no devices found for %s\n",
diff --git a/mdadm.h b/mdadm.h
index 91ba624..04b87b8 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -153,6 +153,11 @@ struct mdinfo {
int cache_size; /* size of raid456 stripe cache*/
int mismatch_cnt;
char text_version[50];
+ void *update_private; /* for passing metadata-format
+ * specific update data
+ * between successive calls to
+ * update_super()
+ */
int container_member; /* for assembling external-metatdata arrays
* This is to be used internally by metadata
diff --git a/super-intel.c b/super-intel.c
index eaf5b0b..110c4a8 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1378,8 +1378,6 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info,
char *update, char *devname, int verbose,
int uuid_set, char *homehost)
{
- /* FIXME */
-
/* For 'assemble' and 'force' we need to return non-zero if any
* change was made. For others, the return value is ignored.
* Update options are:
@@ -1395,26 +1393,55 @@ static int update_super_imsm(struct supertype *st, struct mdinfo *info,
* linear only
* resync: mark as dirty so a resync will happen.
* name: update the name - preserving the homehost
+ * uuid: Change the uuid of the array to match watch is given
*
* Following are not relevant for this imsm:
* sparc2.2 : update from old dodgey metadata
* super-minor: change the preferred_minor number
* summaries: update redundant counters.
- * uuid: Change the uuid of the array to match watch is given
* homehost: update the recorded homehost
* _reshape_progress: record new reshape_progress position.
*/
- int rv = 0;
- //struct intel_super *super = st->sb;
- //struct imsm_super *mpb = super->mpb;
+ int rv = 1;
+ struct intel_super *super = st->sb;
+ struct imsm_super *mpb;
- if (strcmp(update, "grow") == 0) {
- }
- if (strcmp(update, "resync") == 0) {
- /* dev->vol.dirty = 1; */
- }
+ /* we can only update container info */
+ if (!super || super->current_vol >= 0 || !super->anchor)
+ return 1;
+
+ mpb = super->anchor;
+
+ if (strcmp(update, "uuid") == 0 && uuid_set && !info->update_private)
+ fprintf(stderr,
+ Name ": '--uuid' not supported for imsm metadata\n");
+ else if (strcmp(update, "uuid") == 0 && uuid_set && info->update_private) {
+ mpb->orig_family_num = *((__u32 *) info->update_private);
+ rv = 0;
+ } else if (strcmp(update, "uuid") == 0) {
+ __u32 *new_family = malloc(sizeof(*new_family));
+
+ /* update orig_family_number with the incoming random
+ * data, report the new effective uuid, and store the
+ * new orig_family_num for future updates.
+ */
+ if (new_family) {
+ memcpy(&mpb->orig_family_num, info->uuid, sizeof(__u32));
+ uuid_from_super_imsm(st, info->uuid);
+ *new_family = mpb->orig_family_num;
+ info->update_private = new_family;
+ rv = 0;
+ }
+ } else if (strcmp(update, "assemble") == 0)
+ rv = 0;
+ else
+ fprintf(stderr,
+ Name ": '--update=%s' not supported for imsm metadata\n",
+ update);
- /* IMSM has no concept of UUID or homehost */
+ /* successful update? recompute checksum */
+ if (rv == 0)
+ mpb->check_sum = __le32_to_cpu(__gen_imsm_checksum(mpb));
return rv;
}
next prev parent reply other threads:[~2009-10-14 2:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 2:10 [mdadm PATCH 00/12] External metadata updates and other fixes for 3.0.3 Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 01/12] imsm: cleanup disk status tests Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 02/12] imsm: kill close() of component device Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 03/12] imsm: disambiguate family_num Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 04/12] imsm: fix spare record writeout race Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 05/12] imsm: fix/support --update Dan Williams
2009-10-14 2:10 ` [mdadm PATCH 06/12] ddf: prevent superblock being zeroed on --update Dan Williams
2009-10-14 2:10 ` Dan Williams [this message]
2009-10-14 2:10 ` [mdadm PATCH 08/12] imsm: regression test for prodigal array member scenario Dan Williams
2009-10-14 2:11 ` [mdadm PATCH 09/12] Detail: export MD_UUID from mapfile Dan Williams
2009-10-14 2:11 ` [mdadm PATCH 10/12] mdmon: avoid writes in the startup path for mdmon on root arrays Dan Williams
2009-10-14 2:11 ` [mdadm PATCH 11/12] mdmon: exec(2) when the switchroot argument is not "/" Dan Williams
2009-10-19 1:57 ` Neil Brown
2009-10-14 2:11 ` [mdadm PATCH 12/12] mdmon: preserve socket over chroot Dan Williams
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=20091014021051.31570.54396.stgit@dwillia2-linux.ch.intel.com \
--to=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=krzysztof.wojcik@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=maciej.patelczyk@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;
as well as URLs for NNTP newsgroup(s).