Skip to contentSkip to conversation

Fix regression when no PID file

PATCH Applied Mateusz Kusiak 2 participants 3 messages Feb 28, 2024 – Feb 29, 2024 MD RAID

lore
Share & tools
lore
#0 lore raw

cover Fix regression when no PID file

Following patch is a fix for regression introduced by commit b7d7837128e9 ("Monitor: open file before check in check_one_sharer()").

This prevented Monitor from starting if there was no PID file in /run/mdadm.

Mateusz Kusiak (1):
Monitor: Allow no PID in check_one_sharer()

 Monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/1 Monitor: Allow no PID in check_one_sharer()

Commit 5fb5479ad100 ("Monitor: open file before check in check_one_sharer()") introduced a regression that prohibits monitor from starting if PID file does not exist.

Add check for no PID file.
Add missing fclose().

---
 Monitor.c | 5 +++++
 1 file changed, 5 insertions(+)
Monitor.c +5 -0
index 7cee95d4487a..9be2b5287a1a 100644
@@ -453,12 +453,17 @@ static int check_one_sharer(int scan)
 
 	fp = fopen(AUTOREBUILD_PID_PATH, "r");
 	if (!fp) {
+		/* PID file does not exist */
+		if (errno == ENOENT)
+			return 0;
+
 		pr_err("Cannot open %s file.\n", AUTOREBUILD_PID_PATH);
 		return 2;
 	}
 
 	if (!is_file(AUTOREBUILD_PID_PATH)) {
 		pr_err("%s is not a regular file.\n", AUTOREBUILD_PID_PATH);
+		fclose(fp);
 		return 2;
 	}
 
Signature · 1 line
2.35.3
#2 lore raw
In reply to Mateusz Kusiak
Quoted 12 lines · On Wed, 28 Feb 2024 16:37:19 +0100 Mateusz Kusiak <[email protected]>…

Following patch is a fix for regression introduced by commit b7d7837128e9 ("Monitor: open file before check in check_one_sharer()").

This prevented Monitor from starting if there was no PID file in /run/mdadm.

Mateusz Kusiak (1):
Monitor: Allow no PID in check_one_sharer()

 Monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

Applied!

Thanks,
Mariusz