]> git.ipfire.org Git - thirdparty/mdadm.git/commit
mdadm: Fix socket connection failure when mdmon runs in foreground mode.
authorShminderjit Singh <shminderjit.singh@oracle.com>
Mon, 24 Jun 2024 08:58:51 +0000 (08:58 +0000)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 2 Jul 2024 10:15:46 +0000 (12:15 +0200)
commit3cbe13403ec0c78374343dcd889609aefe791f9b
tree4aa37b64750e1c2729150ea5853daf6accd08673
parentb49cbdf48362aa431807a459e1e5c0c2d9549512
mdadm: Fix socket connection failure when mdmon runs in foreground mode.

While creating an IMSM RAID, mdadm will wait for the mdmon main process
to finish if mdmon runs in forking mode. This is because with
"Type=forking" in the mdmon service unit file, "systemctl start service"
will block until the main process of mdmon exits. At that moment, mdmon
has already created the socket, so the subsequent socket connect from
mdadm will succeed.

However, when mdmon runs in foreground mode (without "Type=forking" in
the service unit file), "systemctl start service" will return once the
mdmon process starts. This causes mdadm and mdmon to run in parallel,
which may lead to a socket connection failure since mdmon has not yet
initialized the socket when mdadm tries to connect. If the next
instruction/command is to access this device and try to  write to it, a
permission error will occur since mdmon has not yet set the array to RW
mode.

Signed-off-by: Shminderjit Singh <shminderjit.singh@oracle.com>
Create.c
mdadm.h
util.c