[Filesystems-devel] Bug#1025791: fsck.f2fs is unable to check mounted FS
Michael Tokarev
mjt at tls.msk.ru
Fri Dec 9 08:16:46 GMT 2022
Package: f2fs-tools
Version: 1.14.0-2
Severity: important
When running an fsck.f2fs on a readonly-mounted filesystem (root filesystem
for example, which obviously can not be unmounted), fsck.f2fs always fails:
# fsck.f2fs /dev/sda2
Info: Mounted device!
Info: Check FS only on RO mounted device
Error: Failed to open the device!
# echo $?
8
# _
The problem is that open() fails with EBUSY:
# strace fsck.f2fs /dev/sda2
...
write(1, "Info: Mounted device!\n", 22Info: Mounted device!
) = 22
write(1, "Info: Check FS only on RO mounte"..., 41Info: Check FS only on RO mounted device
) = 41
stat("/dev/mmcblk1p2", {st_mode=S_IFBLK|0660, st_rdev=makedev(0xb3, 0x2), ...}) = 0
openat(AT_FDCWD, "/dev/sda2", O_RDWR|O_EXCL) = -1 EBUSY (Device or resource busy)
openat(AT_FDCWD, "/dev/sda2", O_RDONLY|O_EXCL) = -1 EBUSY (Device or resource busy)
write(1, "\tError: Failed to open the devic"..., 35 Error: Failed to open the device!
) = 35
exit_group(8) = ?
I don't know if this is a kernel issue (who explicitly prevents
opening of a mounted block device) or f2fs-tools issue (who is
not doing any special actions required to work around that), but
the result is that the root filesystem is never checked for errors,
and the boot process always complains about failed fsck.
Other filesystems (eg ext*fs) is able to check and repair a mounted
(read-only) filesystem just fine.
This is why I think this bug is of Severity: important. The only way
to check f2fs root filesystem for errors is to put fsck.f2fs into
initramfs and go from there, or boot some rescue media.
Thanks,
/mjt
-- System Information:
Debian Release: 11.5
APT prefers stable-security
APT policy: (990, 'stable-security'), (990, 'stable'), (500, 'stable-debug'), (500, 'oldstable'), (99, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.0.0-4-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=ru_RU.utf8, LC_CTYPE=ru_RU.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
More information about the Filesystems-devel
mailing list