summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-03-18 12:31:45 +1100
committerNeilBrown <neilb@suse.de>2011-03-18 12:31:45 +1100
commitd6221e667f55c46505125ae182051de499000ed8 (patch)
treea0774b3a0df793772d34dc7daf5752a87dda2957
parenteb0af52689656f6526540ee3a72b0647e7a7b20d (diff)
downloadmdadm-d6221e667f55c46505125ae182051de499000ed8.tar.gz
Manage: fix the mess I made in earlier patch.
When I separated the 'native metadata' case more cleanly from the "external metadata" case for adding a drive, I left some 'external' code in the 'native' case, and didn't copy it to the 'external' case. When - in the external case - we add to super, we much check for mdmon first, so we know whether to do the metadata update ourselves or not, then afterwards call either flush_metadata_updates (to send to mdmon) or sync_metadata (to do it directly). Reported-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Manage.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Manage.c b/Manage.c
index 3361269..a679c24 100644
--- a/Manage.c
+++ b/Manage.c
@@ -835,9 +835,6 @@ int Manage_subdevs(char *devname, int fd,
if (dv->writemostly == 1)
disc.state |= 1 << MD_DISK_WRITEMOSTLY;
dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
- if (tst->ss->external &&
- mdmon_running(tst->container_dev))
- tst->update_tail = &tst->updates;
if (tst->ss->add_to_super(tst, &disc, dfd,
dv->devname)) {
close(dfd);
@@ -898,13 +895,18 @@ int Manage_subdevs(char *devname, int fd,
}
dfd = dev_open(dv->devname, O_RDWR | O_EXCL|O_DIRECT);
+ if (mdmon_running(tst->container_dev))
+ tst->update_tail = &tst->updates;
if (tst->ss->add_to_super(tst, &disc, dfd,
dv->devname)) {
close(dfd);
close(container_fd);
return 1;
}
- close(dfd);
+ if (st->update_tail)
+ flush_metadata_updates(st);
+ else
+ tst->ss->sync_metadata(st);
sra = sysfs_read(container_fd, -1, 0);
if (!sra) {