On 2020/2/23 2:28, Ondřej Jirman wrote:
> Hello,
>
> I was trying to run: fsck.f2fs --dry-run /dev/mmcblk0p2 on a RO mounted
> device,
> and fsck refuses to run. Strace shows that it tries to open the block device
> with O_EXCL even in RO mode, which will always fail if the block device
> is mounted.
Thanks for your report, I've figured out one patch to fix this.
Thanks,
>
> openat(AT_FDCWD, "/proc/mounts", O_RDONLY|O_CLOEXEC) = 3
> fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
> read(3, "/dev/root / f2fs ro,lazytime,rel"..., 1024) = 843
> close(3) = 0
> 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
> stat64("/dev/mmcblk0p2", {st_mode=S_IFBLK|0600, st_rdev=makedev(0xb3, 0x2),
> ...}) = 0
> openat(AT_FDCWD, "/dev/mmcblk0p2", O_RDWR|O_EXCL|O_LARGEFILE) = -1 EBUSY
> (Device or resource busy)
> openat(AT_FDCWD, "/dev/mmcblk0p2", O_RDONLY|O_EXCL|O_LARGEFILE) = -1 EBUSY
> (Device or resource busy)
> write(1, "\tError: Failed to open the devic"..., 35 Error: Failed to open
> the device!
> ) = 35
> exit_group(-1) = ?
> +++ exited with 255 +++
>
>
> fsck.f2fs --dry-run /dev/mmcblk0p2
> Info: Dry run
> Info: Mounted device!
> Info: Check FS only on RO mounted device
> Error: Failed to open the device!
>
> I suggest not using O_EXCL for --dry-run check.
>
> regards,
> Ondrej
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
>
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel