From: Pawel Baldysiak Date: Fri, 11 Mar 2016 12:49:07 +0000 (+0100) Subject: Grow: close fd earlier to avoid "cannot get excl access" when stopping X-Git-Tag: mdadm-4.0~113 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=ad2f4646023474c59adb448a096d4b02ce33298f Grow: close fd earlier to avoid "cannot get excl access" when stopping If this file descriptor is not closed here, it remains open during reshape process and stopping process will end up with "cannot get exclusive access to container". Once this file descriptor is no longer needed - it can be closed. Signed-off-by: Pawel Baldysiak Signed-off-by: Jes Sorensen --- diff --git a/Grow.c b/Grow.c index cf2750aa..d9db00be 100755 --- a/Grow.c +++ b/Grow.c @@ -2070,6 +2070,10 @@ size_change_error: * number of devices (On-Line Capacity Expansion) must be * performed at the level of the container */ + if (fd > 0) { + close(fd); + fd = -1; + } rv = reshape_container(container, devname, -1, st, &info, c->force, c->backup_file, c->verbose, 0, 0, 0); frozen = 0;