From: NeilBrown Date: Wed, 24 Jul 2013 02:21:10 +0000 (+1000) Subject: Grow: don't hold array open while waiting for reshape. X-Git-Tag: mdadm-3.3-rc2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3377ee4248b4b710cc8b62fb9f7057dd7b8b4dfe;p=thirdparty%2Fmdadm.git Grow: don't hold array open while waiting for reshape. If we will need to change array level when a reshape completes, a copy of mdadm waits in the background. Currently this copy hold the device (/dev/mdX) open. This prevents the array from being stopped. So close the file descriptor and re-open after the reshape completes. Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index b552a3f3..c1ae6e83 100644 --- a/Grow.c +++ b/Grow.c @@ -3086,9 +3086,11 @@ static int reshape_array(char *container, int fd, char *devname, map_fork(); break; } + close(fd); wait_reshape(sra); - impose_level(fd, info->new_level, devname, verbose); - + fd = open_dev(sra->sys_name); + if (fd >= 0) + impose_level(fd, info->new_level, devname, verbose); return 0; case 1: /* Couldn't set data_offset, try the old way */ if (data_offset != INVALID_SECTORS) {