mdadm/0107-Use-existence-of-etc-initrd-release-to-detect-initrd.patch
Xiao Ni adfbb8ebd5 Update to latest upstream and fix mdcheck service bug
If mdcheck_start service can finish check action, it doesn't need to start mdcheck_continue
service. So in rhel only patch mdcheck.patch, we stop mdcheck_continue timer.

And there is a history problem. It needed KillMode=none before, so it removed
the upstream patch 52c67fcdd. Now this problem has been fixed, so we can do the
backport more easilly now. We don't need to remove the upstream patch here again.

Resolves: rhbz#2116418, rhbz#2150862, rhbz#2159584

Signed-off-by: Xiao Ni <xni@redhat.com>
2023-05-16 16:08:25 +08:00

42 lines
1.3 KiB
Diff

From eb45d0add7cf2918f838bec2d93d99cf2d9c662f Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 13 Mar 2023 14:42:58 +1100
Subject: [PATCH 107/125] Use existence of /etc/initrd-release to detect
initrd.
Since v183, systemd has used the existence of /etc/initrd-release to
detect if it is running in an initrd, rather than looking at the magic
number of the root filesystem's device. It is time for mdadm to do the
same.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
---
util.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/util.c b/util.c
index 9f1e1f7c..509fb43e 100644
--- a/util.c
+++ b/util.c
@@ -2227,15 +2227,7 @@ int continue_via_systemd(char *devnm, char *service_name)
int in_initrd(void)
{
- /* This is based on similar function in systemd. */
- struct statfs s;
- /* statfs.f_type is signed long on s390x and MIPS, causing all
- sorts of sign extension problems with RAMFS_MAGIC being
- defined as 0x858458f6 */
- return statfs("/", &s) >= 0 &&
- ((unsigned long)s.f_type == TMPFS_MAGIC ||
- ((unsigned long)s.f_type & 0xFFFFFFFFUL) ==
- ((unsigned long)RAMFS_MAGIC & 0xFFFFFFFFUL));
+ return access("/etc/initrd-release", F_OK) >= 0;
}
void reopen_mddev(int mdfd)
--
2.38.1