All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] f2fs.fsck should allow dry-run on RO mounted device
@ 2020-02-22 18:28 Ondřej Jirman
  2020-02-24 11:31 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Ondřej Jirman @ 2020-02-22 18:28 UTC (permalink / raw)
  To: linux-f2fs-devel

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.

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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [f2fs-dev] f2fs.fsck should allow dry-run on RO mounted device
  2020-02-22 18:28 [f2fs-dev] f2fs.fsck should allow dry-run on RO mounted device Ondřej Jirman
@ 2020-02-24 11:31 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-02-24 11:31 UTC (permalink / raw)
  To: Ondřej Jirman, linux-f2fs-devel

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
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-24 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 18:28 [f2fs-dev] f2fs.fsck should allow dry-run on RO mounted device Ondřej Jirman
2020-02-24 11:31 ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.