The -l (lockdisk) option was introduced by util-linux in commit dd0bd943f9 ("fsck: add support for whole-disk locking (-l option)", 2010-10-26, first released in v2.19). systemd-fsck passes -l to /sbin/fsck for parallel fsck support since commit 87c3e6c ("fsck: pass -l to fsck"). Currently the e2fsprogs fsck wrapper (misc/fsck.c, installed via make install) does not recognize -l and passes it through to e2fsck. Since e2fsck's getopt string declares "l:" (requires argument), it consumes the next argument as the bad_blocks_file parameter. This triggers a chain of failures: systemd-fsck -> fsck -a -T -l -M -C6 /dev/sda -> wrapper consumes -a,-T,-M,-C6, adds -C, passes -l -> fsck.ext4 -a -l -C /dev/sda -> e2fsck getopt: -l consumes -C as bad_blocks_file -> journal recovery -> orphan cleanup (orphan inodes processed) -> fopen("-C", "r") fails -> E2F_FLAG_ABORT -> superblock not flushed (s_last_orphan still non-zero) -> kernel: "bad orphan inode" on next mount This is because the e2fsprogs wrapper lacks a case for -l in its option parsing, unlike the util-linux wrapper which handles it correctly (lockdisk = 1). Fix by adding case 'l': break; to consume the option in the wrapper, matching util-linux's behavior. Users can still pass -l to e2fsck via the "--" separator (e.g., "fsck -- -l badblocks_file /dev/sda") or by invoking e2fsck directly. Signed-off-by: Baokun Li --- misc/fsck.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/misc/fsck.c b/misc/fsck.c index 44577590bca5..cb935e1b4b71 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -1212,6 +1212,9 @@ static void PRS(int argc, char *argv[]) case 'M': ignore_mounted++; break; + case 'l': + /* lockdisk option from util-linux fsck, consumed by wrapper */ + break; case 'P': parallel_root++; break; -- 2.43.7