From: Artur Paszkiewicz Date: Wed, 23 Dec 2015 11:57:10 +0000 (+0100) Subject: Grow: close file descriptor earlier to avoid "still in use" when stopping X-Git-Tag: mdadm-3.4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10df72a080f71f01553a14ed8112cee6af7912e8;p=thirdparty%2Fmdadm.git Grow: close file descriptor earlier to avoid "still in use" when stopping Close fd2 as soon as it is no longer needed, before calling Grow_continue(). Otherwise, we won't be able to stop an array with external metadata during reshape, because mdadm running in background will be keeping it open. Signed-off-by: Artur Paszkiewicz Signed-off-by: Pawel Baldysiak Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index 89e4c341..bbdd46c0 100755 --- a/Grow.c +++ b/Grow.c @@ -4885,6 +4885,9 @@ int Grow_continue_command(char *devname, int fd, sysfs_init(content, fd2, mdstat->devnm); + close(fd2); + fd2 = -1; + /* start mdmon in case it is not running */ if (!mdmon_running(container))