From f15661bcf685b493e1ed02e5fb5ad9a40ebf7110 Mon Sep 17 00:00:00 2001 From: Kyle MacLeod Date: Fri, 2 Dec 2022 10:38:49 -0500 Subject: [PATCH] Allow e2fsck exit codes of 0,1 From the e2fsck man pages, the exit codes of 0, 1, 2 should not be treated as failures. We should never see exit code 2 though, since it only occurs when e2fsck is run against a mounted filesystem. The solution is to extend the check to only fail on exit code > 1. Test Plan PASS: Verify e2fsck exit code handling during subcloud install with resized partition Closes-Bug: 1998611 Change-Id: Ie22fd77e3d2e2d631ba467b818bdc77c77f0d8b8 Signed-off-by: Kyle MacLeod --- kickstart/files/miniboot.cfg | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kickstart/files/miniboot.cfg b/kickstart/files/miniboot.cfg index adedd2bb..385f0de5 100644 --- a/kickstart/files/miniboot.cfg +++ b/kickstart/files/miniboot.cfg @@ -1781,7 +1781,14 @@ if [ "${backup_part_extension_required}" -ne 0 ]; then wlog "Platform Backup partition: resizing ${BACKUP_PART} from ${BACKUP_PART_CURRENT_SIZE}MiB to ${BACKUP_SIZE}MiB" e2fsck -p -f ${BACKUP_PART} rc=$? - [ ${rc} -ne 0 ] && report_failure_with_msg "e2fsck failed on platform backup partition [rc=${rc}]" + # Handle e2fsck exit code, non-zero can still indicate success: + # 0 - No errors + # 1 - File system errors corrected + # 2 - File system errors corrected, system should be rebooted + # > 2 are all hard failures (see man e2fsck) + # Include 2 as a failure in our case, since it should only happen if the filesystem + # is mounted while e2fsck is run (not a valid scenario here). + [ ${rc} -gt 1 ] && report_failure_with_msg "e2fsck failed on platform backup partition [rc=${rc}]" resize2fs -f ${BACKUP_PART} rc=$? [ ${rc} -ne 0 ] && report_failure_with_msg "Failed to resize ext4 fs of platform backup partition [rc=${rc}]"