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>
This commit is contained in:
NeilBrown 2011-03-18 12:31:45 +11:00
parent eb0af52689
commit d6221e667f
1 changed files with 6 additions and 4 deletions

View File

@ -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) {