linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix regression when no PID file
@ 2024-02-28 15:37 Mateusz Kusiak
  2024-02-28 15:37 ` [PATCH 1/1] Monitor: Allow no PID in check_one_sharer() Mateusz Kusiak
  2024-02-29 13:10 ` [PATCH 0/1] Fix regression when no PID file Mariusz Tkaczyk
  0 siblings, 2 replies; 3+ messages in thread
From: Mateusz Kusiak @ 2024-02-28 15:37 UTC (permalink / raw)
  To: linux-raid; +Cc: jes, mariusz.tkaczyk

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(+)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] Monitor: Allow no PID in check_one_sharer()
  2024-02-28 15:37 [PATCH 0/1] Fix regression when no PID file Mateusz Kusiak
@ 2024-02-28 15:37 ` Mateusz Kusiak
  2024-02-29 13:10 ` [PATCH 0/1] Fix regression when no PID file Mariusz Tkaczyk
  1 sibling, 0 replies; 3+ messages in thread
From: Mateusz Kusiak @ 2024-02-28 15:37 UTC (permalink / raw)
  To: linux-raid; +Cc: jes, mariusz.tkaczyk

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().

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
---
 Monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Monitor.c b/Monitor.c
index 7cee95d4487a..9be2b5287a1a 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -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;
 	}
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] Fix regression when no PID file
  2024-02-28 15:37 [PATCH 0/1] Fix regression when no PID file Mateusz Kusiak
  2024-02-28 15:37 ` [PATCH 1/1] Monitor: Allow no PID in check_one_sharer() Mateusz Kusiak
@ 2024-02-29 13:10 ` Mariusz Tkaczyk
  1 sibling, 0 replies; 3+ messages in thread
From: Mariusz Tkaczyk @ 2024-02-29 13:10 UTC (permalink / raw)
  To: Mateusz Kusiak; +Cc: linux-raid, jes

On Wed, 28 Feb 2024 16:37:19 +0100
Mateusz Kusiak <mateusz.kusiak@intel.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-29 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28 15:37 [PATCH 0/1] Fix regression when no PID file Mateusz Kusiak
2024-02-28 15:37 ` [PATCH 1/1] Monitor: Allow no PID in check_one_sharer() Mateusz Kusiak
2024-02-29 13:10 ` [PATCH 0/1] Fix regression when no PID file Mariusz Tkaczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).