]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: close file descriptor earlier to avoid "still in use" when stopping
authorArtur Paszkiewicz <artur.paszkiewicz@intel.com>
Wed, 23 Dec 2015 11:57:10 +0000 (12:57 +0100)
committerNeilBrown <neilb@suse.com>
Wed, 23 Dec 2015 23:00:00 +0000 (10:00 +1100)
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 <artur.paszkiewicz@intel.com>
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 89e4c3413190e238d16afa2417cb8811501ce93d..bbdd46c0e600dc8c245e9e8a51766ae9bcaee4c0 100755 (executable)
--- 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))