-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Mergerfs creates directories with incorrect permissions when using NFS mounts without no_root_squash #1218
Comments
Without going over all the details you've provided yet... mergerfs expects / requires the ability to run some commands as root that can only be done as root on a standard POSIX filesystem. Root squash naturally breaks that expectation / requirement. No different from some other non-POSIX compliant filesystems. I can look at adding workarounds for this situation. |
Thanks for the quick response! I agree that having root_squash enabled does introduce some non-standard behaviour. I think that if it is possible to create the necessary directories with the expected permissions immediately instead of chown-ing them later that would be ideal. |
Yeah, it can be done that way but needs to be carefully managed. Can't just change the behavior generally because cloning of paths will not work as non-root in many cases and having to jump to and from root isn't ideal either. Also don't want to perform an action and have to check the result to see if it matches expectation every time as more syscalls means more overhead. root squash behaves in similar ways to some other non-posix filesystems where the expected response of a syscall doesn't match the actual. Perhaps could allow branches to be marked with their incompatibilities so it can work around it or look to figure it out but at the moment there isn't a easy way to add such options to branches or to act on them due to the lack of a config file. Something I'm working on. |
I'm trying to rewrite the clone path routines to work in this case of squashed root. It requires more syscalls to manage but shouldn't cause any real issues. One thing that did dawn on me though is that NFS acls would be a whole other can of worms (like not being able to delete your own files) so I'm just going to ignore that for now. |
I spent a good amount of time the past few days playing with this and I'm really not sure how well this can work. If all the perms and ownership line up then it could work in some situations but if paths don't have that they will at best be created with incorrect values. Worse, error out. Remember that it isn't just creating directories. It is trying to clone the path as found on another branch. If I suppose I could try anyway but IMO the errors will be confusing and seemingly random to people. |
Describe the bug
I have two machines named
truenas
andubuntu
running respectively Truenas Scale and Ubunutu Server.Both machines have a user named
user
withuid=1000
andgid=1000
Mergerfs is running on the
ubuntu
machine andtruenas
exports two NFS shares.The two shares are exported with the following options on
truenas
:I have mounted the two shares with the following options on
ubuntu
:I have created a mergerfs pool with the following options on
ubuntu
I have the following files files/directories on both drives:
Note that
/mnt/big1/files/tankdir/
does not exist.I attempt to run the following command
user@ubuntu:~$ mv /mnt/merge/files/bigfile /mnt/merge/files/tankdir/
Expected
According to my options
category.create=epff,ignorepponrename=true
the directory/mnt/big1/files/tankdir/
should be created and/mnt/big1/files/bigfile
should be moved inside it.Actual
The command fails with
The drives look like this afterwards:
tankdir
is created but with the wrong permissions.Workaround
I change the exports to look like this:
I run
I run
It works as expected.
To Reproduce
no_root_squash
)/mnt/disk1
and/mnt/disk2
)/mnt/disk1/dir1/
/mnt/disk2/file2
/mnt/disk2/dir1/
does not exist/mnt/disk1:/mnt/disk2 /mnt/merge
) with the same options as abovemv /mnt/merge/file2 /mnt/merge/dir1/
Actual behavior
/mnt/disk2/dir1/
with ownernobody:nogroup
Expected behavior
/mnt/disk2/dir1/
with the same owner as/mnt/disk1/dir1/
/mnt/disk2/file2
is moved into/mnt/disk2/dir1/
System information:
uname -a
mergerfs -V
df -h
lsblk -f
app.strace.txt
mergerfs.strace.txt
Additional context
Possible issue
Looking at the trace files it seams that mergerfs first creates the directory as
root
and then attempts tochown user:user
However when a directory is created as root on NFS without
no_root_squash
it is mapped to ownernobody:nogroup
and afterwards it cannot be modified through NFS. Next the rename operation fails because again even the root user has no write permissions in the newly created directory.The text was updated successfully, but these errors were encountered: