]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: close fd earlier to avoid "cannot get excl access" when stopping
authorPawel Baldysiak <pawel.baldysiak@intel.com>
Fri, 11 Mar 2016 12:49:07 +0000 (13:49 +0100)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 11 Mar 2016 17:32:31 +0000 (12:32 -0500)
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 <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index cf2750aab2c8f18c96922e69b4937a86647fd4d6..d9db00be18638bcafd41d62e9c56d3c310ef4f68 100755 (executable)
--- 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;