Created
January 22, 2023 15:45
-
-
Save Ansuel/cfb870ca9385e2b1b92521671d87bf35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 6a4d42ca87035666eb008095f18dc0657c98898e Mon Sep 17 00:00:00 2001 | |
From: Christian Marangi <ansuelsmth@gmail.com> | |
Date: Sun, 22 Jan 2023 16:43:35 +0100 | |
Subject: [PATCH] partname: Introduce fstools_partname_fallback_scan option | |
Some device may contains a GPT partition named rootfs_data that may | |
not be suitable. | |
To save from regression with old implementation that doesn't use | |
fstools_ignore_partname to explicitly say that that parname scan | |
should be ignored, make explicit that scanning each partition should | |
be done by providing fstools_partname_fallback_scan=1 and skip partname | |
scan in every other case. | |
Fixes: e9b59f063bb3 ("partname: Ignore root=PARTUUID...") | |
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> | |
--- | |
libfstools/partname.c | 13 +++++++++++++ | |
1 file changed, 13 insertions(+) | |
diff --git a/libfstools/partname.c b/libfstools/partname.c | |
index 9c27015..f42322a 100644 | |
--- a/libfstools/partname.c | |
+++ b/libfstools/partname.c | |
@@ -133,6 +133,19 @@ static struct volume *partname_volume_find(char *name) | |
/* find partition on same device as rootfs */ | |
snprintf(ueventgstr, sizeof(ueventgstr), "%s/%s/*/uevent", block_dir_name, rootdev); | |
} else { | |
+ /* | |
+ * Some device may contains a GPT partition named rootfs_data that may not be suitable. | |
+ * To save from regression with old implementation that doesn't use fstools_ignore_partname to | |
+ * explicitly say that that parname scan should be ignored, make explicit that scanning each | |
+ * partition should be done by providing fstools_partname_fallback_scan=1 and skip partname scan | |
+ * in every other case. | |
+ */ | |
+ if (!get_var_from_file("/proc/cmdline", "fstools_partname_fallback_scan", rootparam, sizeof(rootparam))) | |
+ return NULL; | |
+ | |
+ if (!strcmp("1", rootparam)) | |
+ return NULL; | |
+ | |
/* no useful 'root=' kernel cmdline parameter, find on any block device */ | |
snprintf(ueventgstr, sizeof(ueventgstr), "%s/*/uevent", block_dir_name); | |
} | |
-- | |
2.38.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment