From: Dave Dykstra <dwd@cern.ch>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-ext4@vger.kernel.org,
Dave Dykstra <2129743+DrDaveD@users.noreply.github.com>
Subject: Re: [PATCH] fuse2fs: open read-only when ro option and image non-writable
Date: Fri, 17 Oct 2025 15:14:45 -0500 [thread overview]
Message-ID: <aPKjtQz5lmUcWf5O@cern.ch> (raw)
In-Reply-To: <20251017192456.GG6170@frogsfrogsfrogs>
On Fri, Oct 17, 2025 at 12:24:56PM -0700, Darrick J. Wong wrote:
> On Thu, Oct 16, 2025 at 03:02:06PM -0500, Dave Dykstra wrote:
...
> > diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
> > index cb5620c7..2ae2fc1a 100644
> > --- a/misc/fuse2fs.c
> > +++ b/misc/fuse2fs.c
> > @@ -4696,9 +4696,19 @@ int main(int argc, char *argv[])
> > err = ext2fs_open2(fctx.device, options, flags, 0, 0, unix_io_manager,
> > &global_fs);
> > if (err) {
> > - err_printf(&fctx, "%s.\n", error_message(err));
> > - err_printf(&fctx, "%s\n", _("Please run e2fsck -fy."));
> > - goto out;
> > + if (((err == EACCES) || (err == EPERM)) && fctx.ro) {
>
> This is not correct. mount(8) for the kernel ext4 driver responds to
> the block device being readonly by retrying with an ro mount. The user
> is not required to specify 'ro':
>
> # blockdev --setro/ dev/sda
> # strace -e mount mount /dev/sda /mnt
> 40677<mount> 12:19:36 (+ 0.000102) mount("/dev/sda", "/mnt", "ext4", 0, NULL) = -1 EACCES (Permission denied)
> 40677<mount> 12:19:36 (+ 0.000285) mount("/dev/sda", "/mnt", "ext4", MS_RDONLY, NULL) = 0
Ok then, I'll change that.
...
> > fctx.fs = global_fs;
> > global_fs->priv_data = &fctx;
> > @@ -4741,6 +4751,8 @@ int main(int argc, char *argv[])
> > goto out;
> > }
> >
> > + ret = 4;
>
> Why 4? Is this an internal mount bug?
I was just guessing; I didn't know what the bits meant. Where are they
documented? All I knew was that it needed to not include the "& 1" bit
which was included with "ret = 3" because that printed an erroneous
error just after the "out" label.
Dave
next prev parent reply other threads:[~2025-10-17 20:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 20:02 [PATCH] fuse2fs: open read-only when ro option and image non-writable Dave Dykstra
2025-10-17 19:24 ` Darrick J. Wong
2025-10-17 20:14 ` Dave Dykstra [this message]
2025-10-17 20:48 ` Dave Dykstra
2025-10-17 21:16 ` Dave Dykstra
2025-10-17 23:28 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPKjtQz5lmUcWf5O@cern.ch \
--to=dwd@cern.ch \
--cc=2129743+DrDaveD@users.noreply.github.com \
--cc=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox