Flush mdmon before next reshape step during container operation
Using takeover operation for grow purposes, mdadm has to be sure that mdmon processes all updates, and if necessary it will be closed at takeover to raid0 operation. If mdmon is late, next array in container is processed and due to race condition mdmon closes itself instead to monitor next reshape operation. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
50927b1323
commit
78340e26a5
12
Grow.c
12
Grow.c
|
@ -2003,6 +2003,9 @@ static int reshape_array(char *container, int fd, char *devname,
|
|||
|
||||
if (reshape.level > 0 && st->ss->external) {
|
||||
/* make sure mdmon is aware of the new level */
|
||||
if (mdmon_running(st->container_dev))
|
||||
flush_mdmon(container);
|
||||
|
||||
if (!mdmon_running(st->container_dev))
|
||||
start_mdmon(st->container_dev);
|
||||
ping_monitor(container);
|
||||
|
@ -2396,8 +2399,7 @@ started:
|
|||
/* Re-load the metadata as much could have changed */
|
||||
int cfd = open_dev(st->container_dev);
|
||||
if (cfd >= 0) {
|
||||
ping_manager(container);
|
||||
ping_monitor(container);
|
||||
flush_mdmon(container);
|
||||
st->ss->free_super(st);
|
||||
st->ss->load_container(st, cfd, container);
|
||||
close(cfd);
|
||||
|
@ -2594,6 +2596,9 @@ int reshape_container(char *container, char *devname,
|
|||
|
||||
sysfs_init(content, fd, mdstat->devnum);
|
||||
|
||||
if (mdmon_running(devname2devnum(container)))
|
||||
flush_mdmon(container);
|
||||
|
||||
rv = reshape_array(container, fd, adev, st,
|
||||
content, force, NULL,
|
||||
backup_file, quiet, 1, restart,
|
||||
|
@ -2608,6 +2613,9 @@ int reshape_container(char *container, char *devname,
|
|||
restart = 0;
|
||||
if (rv)
|
||||
break;
|
||||
|
||||
if (mdmon_running(devname2devnum(container)))
|
||||
flush_mdmon(container);
|
||||
}
|
||||
if (!rv)
|
||||
unfreeze(st);
|
||||
|
|
10
msg.c
10
msg.c
|
@ -487,3 +487,13 @@ int ping_manager(char *devname)
|
|||
close(sfd);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* using takeover operation for grow purposes, mdadm has to be sure
|
||||
* that mdmon processes all updates, and if necessary it will be closed
|
||||
* at takeover to raid0 operation
|
||||
*/
|
||||
void flush_mdmon(char *container)
|
||||
{
|
||||
ping_manager(container);
|
||||
ping_monitor(container);
|
||||
}
|
||||
|
|
1
msg.h
1
msg.h
|
@ -34,5 +34,6 @@ extern int block_monitor(char *container, const int freeze);
|
|||
extern void unblock_monitor(char *container, const int unfreeze);
|
||||
extern int fping_monitor(int sock);
|
||||
extern int ping_manager(char *devname);
|
||||
extern void flush_mdmon(char *container);
|
||||
|
||||
#define MSG_MAX_LEN (4*1024*1024)
|
||||
|
|
Loading…
Reference in New Issue