Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lklfuse: fallback to read-only mount on EACCES #570

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ddiss
Copy link

@ddiss ddiss commented Feb 21, 2025

The following changes since commit 776984711d7b9ef5d0603a78e56ac32ce2fc4fc0:

  Merge pull request #568 from ddiss/lklfuse_udev_systemd (2025-02-20 00:41:02 -0800)

are available in the Git repository at:

  https://github.com/ddiss/linux lklfuse_ro_fallback

for you to fetch changes up to e7878d1fe964458bacab59aec38df544406024ea:

  lkl: systemd: add iso9660 and udf to udev filter (2025-02-21 23:05:24 +1100)

----------------------------------------------------------------
David Disseldorp (2):
      lklfuse: fallback to read-only mount on EACCES
      lkl: systemd: add iso9660 and udf to udev filter

 tools/lkl/lklfuse.c                | 9 +++++++++
 tools/lkl/systemd/61-lklfuse.rules | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

This matches the behaviour of Linux mount helper, e.g.
  mount("/dev/loop0p1", "/mnt", "iso9660", 0, NULL) = -1 EACCES
  mount("/dev/loop0p1", "/mnt", "iso9660", MS_RDONLY, NULL) = 0
  WARNING: source write-protected, mounted read-only.

Signed-off-by: David Disseldorp <[email protected]>
Both filesystems are common for USB-attached storage, so handle them
with lklfuse.

Signed-off-by: David Disseldorp <[email protected]>
Copy link
Member

@tavip tavip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @ddiss !

@@ -718,6 +718,15 @@ static int start_lkl(void)
ret = lkl_mount_dev(lklfuse.disk_id, lklfuse.part, lklfuse.type,
mount_flags, remaining_mopts,
mpoint, sizeof(mpoint));
if (ret == -LKL_EACCES && !(mount_flags & LKL_MS_RDONLY)) {
Copy link
Member

@tavip tavip Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to drop to readonly if we don't have write access to lklfuse.file bellow?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I don't know :). For mount read-only fallback we have precedence in the existing util-linux behaviour, but open(lklfuse.file, O_RDONLY) fallback could certainly be considered related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants