diff options
author | NeilBrown <neilb@suse.de> | 2011-03-18 02:31:45 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-03-18 02:31:45 +0100 |
commit | d6221e667f55c46505125ae182051de499000ed8 (patch) | |
tree | a0774b3a0df793772d34dc7daf5752a87dda2957 | |
parent | --stop: separate 'is busy' test for 'did it stop properly'. (diff) | |
download | mdadm-d6221e667f55c46505125ae182051de499000ed8.tar.xz mdadm-d6221e667f55c46505125ae182051de499000ed8.zip |
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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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) { |