[PATCH 3/4] fuse2fs: quiet down write-protect warning

Darrick J. Wong
2025-11-06T22:30:49Z

No need to retry the mount with write protection if we already set ro
and cleared EXT2_FLAG_RO.

Fixes: e352b2ad174573 ("fuse2fs: mount norecovery if main block device is readonly")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
misc/fuse2fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 7b94f0df1688a1..bbd79d6c09f4bc 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -4823,7 +4823,8 @@ int main(int argc, char *argv[])
flags |= EXT2_FLAG_DIRECT_IO;
err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
&global_fs);
- if (err == EPERM || err == EACCES) {
+ if ((err == EPERM || err == EACCES) &&
+ (!fctx.ro || (flags & EXT2_FLAG_RW))) {
/*
* Source device cannot be opened for write. Under these
* circumstances, mount(8) will try again with a ro mount,