]> 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>
Tue, 4 Jun 2024 07:46:03 +0000 (07:46 +0000)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 18 Jun 2024 10:51:38 +0000 (12:51 +0200)
commit66a54b266f6c579e5f37b6253820903a55c3346c
tree5344e316e49e6fa37714b48906cfcec7221890f8
parent29aa21d94bc7ff10f3f7ef0b7f490f3903f5c6fd
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>
msg.c