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

WinFsp: Can't set read only file system #15

Open
ncw opened this issue May 10, 2017 · 1 comment
Open

WinFsp: Can't set read only file system #15

ncw opened this issue May 10, 2017 · 1 comment

Comments

@ncw
Copy link
Contributor

ncw commented May 10, 2017

If I pass -o ro to WinFsp then doesn't mark the file system as read only as it does on linux. I think libfuse passes unknown options on to mount.fuse which says in its man page

Most of the generic mount options described in mount are supported (ro, rw, suid, nosuid, dev, nodev, exec, noexec, atime, noatime, sync, async, dirsync).

This brings to mind 3 options

  • Should this be implemented by WinFsp?
  • Or is there a better more FUSE-y way of doing it? (I haven't discovered one in the docs)
  • Or alternatively I could just check for read only and return -EROFS in any methods which do writing?

What is your preferred option?

Thanks

@billziss-gh
Copy link
Collaborator

billziss-gh commented May 10, 2017

It is possible to mark a file system as read-only on WinFsp-FUSE by passing the (WinFsp specific) flag FSP_FUSE_CAP_READ_ONLY during fuse_operations::init. However I did not implement this flag on cgofuse. There are two reasons for this:

  • Read-only file systems on Windows and Linux behave differently. For example, Windows may still send a Write request on a file system that is marked read-only. [Please note that I am not 100% certain of this. I note however that the Windows CDROM file system driver, which is open-sourced, marks itself as read-only but also handles writes!]

  • I do not have good tests for read-only file systems. I did not want to have a situation along the lines of: "you said it's read-only so why am I getting writes".

Clearly this is an area where the WinFsp core could be improved (e.g. by rejecting write requests at the kernel level if the file system is marked read-only). Until that happens I recommend treating every file system as read-write and explicitly rejecting the requests that you do not want to handle with -EROFS.

[NOTE: The WinFsp-FUSE supported options are here and a few additional ones here].

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

No branches or pull requests

2 participants