dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
da180f
From 3f6de92999cf63e234265f51d6ee02134bc75ac3 Mon Sep 17 00:00:00 2001
da180f
From: Karel Zak <kzak@redhat.com>
da180f
Date: Wed, 12 Jun 2019 11:02:51 +0200
da180f
Subject: [PATCH 24/24] findmnt: (verify) ignore passno for XFS
da180f
da180f
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1719069
da180f
Upstream: http://github.com/karelzak/util-linux/commit/f5b7bf155b9881de5b99cc0a23b4dccf9a2d4af3
da180f
Signed-off-by: Karel Zak <kzak@redhat.com>
da180f
---
da180f
 misc-utils/findmnt-verify.c | 12 +++++++++---
da180f
 1 file changed, 9 insertions(+), 3 deletions(-)
da180f
da180f
diff --git a/misc-utils/findmnt-verify.c b/misc-utils/findmnt-verify.c
da180f
index 1cc62def9..73e44a418 100644
da180f
--- a/misc-utils/findmnt-verify.c
da180f
+++ b/misc-utils/findmnt-verify.c
da180f
@@ -28,7 +28,8 @@ struct verify_context {
da180f
 	int	nwarnings;
da180f
 	int	nerrors;
da180f
 
da180f
-	unsigned int	target_printed : 1;
da180f
+	unsigned int	target_printed : 1,
da180f
+			no_fsck : 1;
da180f
 };
da180f
 
da180f
 static void verify_mesg(struct verify_context *vfy, char type, const char *fmt, va_list ap)
da180f
@@ -408,6 +409,8 @@ static int verify_fstype(struct verify_context *vfy)
da180f
 			isauto = 1;
da180f
 		else if (strcmp(type, "swap") == 0)
da180f
 			isswap = 1;
da180f
+		else if (strcmp(type, "xfs") == 0)
da180f
+			vfy->no_fsck = 1;
da180f
 
da180f
 		if (!isswap && !isauto && !none && !is_supported_filesystem(vfy, type))
da180f
 			verify_warn(vfy, _("%s seems unsupported by the current kernel"), type);
da180f
@@ -422,6 +425,7 @@ static int verify_fstype(struct verify_context *vfy)
da180f
 
da180f
 	if (realtype) {
da180f
 		isswap = strcmp(realtype, "swap") == 0;
da180f
+		vfy->no_fsck = strcmp(realtype, "xfs") == 0;
da180f
 
da180f
 		if (type && !isauto && strcmp(type, realtype) != 0)
da180f
 			return verify_err(vfy, _("%s does not match with on-disk %s"), type, realtype);
da180f
@@ -440,7 +444,7 @@ static int verify_passno(struct verify_context *vfy)
da180f
 	int passno = mnt_fs_get_passno(vfy->fs);
da180f
 	const char *tgt = mnt_fs_get_target(vfy->fs);
da180f
 
da180f
-	if (tgt && strcmp("/", tgt) == 0 && passno != 1)
da180f
+	if (tgt && strcmp("/", tgt) == 0 && passno != 1 && !vfy->no_fsck)
da180f
 		return verify_warn(vfy, _("recommended root FS passno is 1 (current is %d)"), passno);
da180f
 
da180f
 	return 0;
da180f
@@ -463,7 +467,7 @@ static int verify_filesystem(struct verify_context *vfy)
da180f
 	if (!rc)
da180f
 		rc = verify_fstype(vfy);
da180f
 	if (!rc)
da180f
-		rc = verify_passno(vfy);
da180f
+		rc = verify_passno(vfy);	/* depends on verify_fstype() */
da180f
 
da180f
 	return rc;
da180f
 }
da180f
@@ -492,6 +496,8 @@ int verify_table(struct libmnt_table *tb)
da180f
 
da180f
 	while (rc == 0 && (vfy.fs = get_next_fs(tb, itr))) {
da180f
 		vfy.target_printed = 0;
da180f
+		vfy.no_fsck = 0;
da180f
+
da180f
 		if (check_order)
da180f
 			rc = verify_order(&vfy;;
da180f
 		if (!rc)
da180f
-- 
da180f
2.21.0
da180f