jacobsa / fuse

A Go package for implementing a FUSE file system.
Apache License 2.0
478 stars 106 forks source link

Remove memfs PID check #131

Closed djschaap closed 1 year ago

djschaap commented 1 year ago

Remove PID zero check from memfs entirely.

Add allowPidZero argument to NewMemFS.

memfs will now accept FUSE calls/operations from the kernel where PID is zero (instead of aborting, as it did previously). This can happen when using multiple PID namespaces (i.e., mount propagation across containers).

Reference: https://github.com/libfuse/libfuse/issues/67

djschaap commented 1 year ago

Yes, that's it exactly. I'm developing a FUSE client that runs within a container to mount a remote filesystem. That mounted filesystem is then made available to several other containers. As part of this, before developing my custom backend, I'm using some of the sample backends to validate & familiarize myself with basic FUSE functionality.

This pid zero check is a show-stopper that seems to have no benefit to my use. Other sample filesystems (hellofs, specifically) seem to be fine without that check.

If you'd prefer not to merge this, that's fine with me - I can operate with a personal fork just fine. I'm offering this PR with the hope it will be useful to someone else, someday.

And - thank you for maintaining this project!

stapelberg commented 1 year ago

This pid zero check is a show-stopper that seems to have no benefit to my use. Other sample filesystems (hellofs, specifically) seem to be fine without that check.

These checks were introduced in https://github.com/jacobsa/fuse/commit/36e01f1b3aaafad29231bd7286dac6c384110502 (cc @xinmeigui-db), but seem to be more for illustration of newly introduced pid field than out of any necessity.

Instead of making the check configurable, how about we just remove it entirely?

xinmeigui-db commented 1 year ago

This pid zero check is a show-stopper that seems to have no benefit to my use. Other sample filesystems (hellofs, specifically) seem to be fine without that check.

These checks were introduced in 36e01f1 (cc @xinmeigui-db), but seem to be more for illustration of newly introduced pid field than out of any necessity.

Instead of making the check configurable, how about we just remove it entirely?

cc @kahing , we are okay with removing it entirely.

djschaap commented 1 year ago

That's great! I will update this PR to remove the memfs pid check entirely.