A sub-mount which is unreachable due to FUSE permissions, disappears when accessed. How?

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I tried to contrive a test case using the FUSE filesystem sshfs. My idea was sshfs would be a bit easier for developers to test with, compared to the original issue which involved NFS. But my idea did not quite work how I expected.
What is happening here?
$ mkdir /tmp/alan
$ sudo mkdir /root/mnt
$ sudo sshfs alan@localhost:/tmp/alan /root/mnt
$ mkdir /tmp/alan/mnt
$ sudo mount --bind /root/mnt/mnt /root/mnt/mnt
$ chmod a-rwx /tmp/alan
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
/root/mnt/mnt alan@localhost:/tmp/alan fuse.sshfs ...
$ mount -oremount,bind,ro /root/mnt/mnt
mount: /root/mnt/mnt: cannot mount (null) read-only.
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
The sub-mount vanished.
If I re-run this and prefix the mount -oremount command with sudo strace -e trace=mount, it shows that system call fails with "Permission denied", so that part seemed to be working as expected.
mount("none", "/root/mnt/mnt", 0x55b13233d620, MS_MGC_VAL|MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = -1 EACCESS (Permission denied)
permissions mount fuse
add a comment |Â
up vote
1
down vote
favorite
I tried to contrive a test case using the FUSE filesystem sshfs. My idea was sshfs would be a bit easier for developers to test with, compared to the original issue which involved NFS. But my idea did not quite work how I expected.
What is happening here?
$ mkdir /tmp/alan
$ sudo mkdir /root/mnt
$ sudo sshfs alan@localhost:/tmp/alan /root/mnt
$ mkdir /tmp/alan/mnt
$ sudo mount --bind /root/mnt/mnt /root/mnt/mnt
$ chmod a-rwx /tmp/alan
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
/root/mnt/mnt alan@localhost:/tmp/alan fuse.sshfs ...
$ mount -oremount,bind,ro /root/mnt/mnt
mount: /root/mnt/mnt: cannot mount (null) read-only.
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
The sub-mount vanished.
If I re-run this and prefix the mount -oremount command with sudo strace -e trace=mount, it shows that system call fails with "Permission denied", so that part seemed to be working as expected.
mount("none", "/root/mnt/mnt", 0x55b13233d620, MS_MGC_VAL|MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = -1 EACCESS (Permission denied)
permissions mount fuse
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I tried to contrive a test case using the FUSE filesystem sshfs. My idea was sshfs would be a bit easier for developers to test with, compared to the original issue which involved NFS. But my idea did not quite work how I expected.
What is happening here?
$ mkdir /tmp/alan
$ sudo mkdir /root/mnt
$ sudo sshfs alan@localhost:/tmp/alan /root/mnt
$ mkdir /tmp/alan/mnt
$ sudo mount --bind /root/mnt/mnt /root/mnt/mnt
$ chmod a-rwx /tmp/alan
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
/root/mnt/mnt alan@localhost:/tmp/alan fuse.sshfs ...
$ mount -oremount,bind,ro /root/mnt/mnt
mount: /root/mnt/mnt: cannot mount (null) read-only.
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
The sub-mount vanished.
If I re-run this and prefix the mount -oremount command with sudo strace -e trace=mount, it shows that system call fails with "Permission denied", so that part seemed to be working as expected.
mount("none", "/root/mnt/mnt", 0x55b13233d620, MS_MGC_VAL|MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = -1 EACCESS (Permission denied)
permissions mount fuse
I tried to contrive a test case using the FUSE filesystem sshfs. My idea was sshfs would be a bit easier for developers to test with, compared to the original issue which involved NFS. But my idea did not quite work how I expected.
What is happening here?
$ mkdir /tmp/alan
$ sudo mkdir /root/mnt
$ sudo sshfs alan@localhost:/tmp/alan /root/mnt
$ mkdir /tmp/alan/mnt
$ sudo mount --bind /root/mnt/mnt /root/mnt/mnt
$ chmod a-rwx /tmp/alan
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
/root/mnt/mnt alan@localhost:/tmp/alan fuse.sshfs ...
$ mount -oremount,bind,ro /root/mnt/mnt
mount: /root/mnt/mnt: cannot mount (null) read-only.
$ findmnt | grep mnt
/root/mnt alan@localhost:/tmp/alan fuse.sshfs ...
The sub-mount vanished.
If I re-run this and prefix the mount -oremount command with sudo strace -e trace=mount, it shows that system call fails with "Permission denied", so that part seemed to be working as expected.
mount("none", "/root/mnt/mnt", 0x55b13233d620, MS_MGC_VAL|MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = -1 EACCESS (Permission denied)
permissions mount fuse
permissions mount fuse
edited Aug 15 at 0:16
asked Aug 14 at 23:51
sourcejedi
20k42883
20k42883
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
You can replace the mount -oremount command with sudo ls /root/mnt/mnt. You get the same EACCESS ("Permission denied") error, and the mount point still disappears.
ls /tmp/alan/mnt would also fail due to EACCESS. Notice that the error will be EACCESS even if /tmp/alan/mnt had also been removed, or replaced with a non-directory file.
Normally, if /tmp/alan/mnt had been removed or replaced with a non-directory, the sub-mount /root/mnt/mnt will no longer be valid, and it will be removed automatically. In this case, when the kernel asks sshfs if /root/mnt/mnt still exists as a directory, sshfs just tells it "Permission denied". The kernel treats this as a failure, just like "No such file or directory".
I don't know if that's exactly what happens.
Also sub-mounts don't seem to vanish when ls on the sub-mount returns ENOTCONN "Transport endpoint is not connected". This error happens when you kill the FUSE process for the parent mount. (See https://github.com/systemd/systemd/issues/9872 )
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You can replace the mount -oremount command with sudo ls /root/mnt/mnt. You get the same EACCESS ("Permission denied") error, and the mount point still disappears.
ls /tmp/alan/mnt would also fail due to EACCESS. Notice that the error will be EACCESS even if /tmp/alan/mnt had also been removed, or replaced with a non-directory file.
Normally, if /tmp/alan/mnt had been removed or replaced with a non-directory, the sub-mount /root/mnt/mnt will no longer be valid, and it will be removed automatically. In this case, when the kernel asks sshfs if /root/mnt/mnt still exists as a directory, sshfs just tells it "Permission denied". The kernel treats this as a failure, just like "No such file or directory".
I don't know if that's exactly what happens.
Also sub-mounts don't seem to vanish when ls on the sub-mount returns ENOTCONN "Transport endpoint is not connected". This error happens when you kill the FUSE process for the parent mount. (See https://github.com/systemd/systemd/issues/9872 )
add a comment |Â
up vote
1
down vote
You can replace the mount -oremount command with sudo ls /root/mnt/mnt. You get the same EACCESS ("Permission denied") error, and the mount point still disappears.
ls /tmp/alan/mnt would also fail due to EACCESS. Notice that the error will be EACCESS even if /tmp/alan/mnt had also been removed, or replaced with a non-directory file.
Normally, if /tmp/alan/mnt had been removed or replaced with a non-directory, the sub-mount /root/mnt/mnt will no longer be valid, and it will be removed automatically. In this case, when the kernel asks sshfs if /root/mnt/mnt still exists as a directory, sshfs just tells it "Permission denied". The kernel treats this as a failure, just like "No such file or directory".
I don't know if that's exactly what happens.
Also sub-mounts don't seem to vanish when ls on the sub-mount returns ENOTCONN "Transport endpoint is not connected". This error happens when you kill the FUSE process for the parent mount. (See https://github.com/systemd/systemd/issues/9872 )
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You can replace the mount -oremount command with sudo ls /root/mnt/mnt. You get the same EACCESS ("Permission denied") error, and the mount point still disappears.
ls /tmp/alan/mnt would also fail due to EACCESS. Notice that the error will be EACCESS even if /tmp/alan/mnt had also been removed, or replaced with a non-directory file.
Normally, if /tmp/alan/mnt had been removed or replaced with a non-directory, the sub-mount /root/mnt/mnt will no longer be valid, and it will be removed automatically. In this case, when the kernel asks sshfs if /root/mnt/mnt still exists as a directory, sshfs just tells it "Permission denied". The kernel treats this as a failure, just like "No such file or directory".
I don't know if that's exactly what happens.
Also sub-mounts don't seem to vanish when ls on the sub-mount returns ENOTCONN "Transport endpoint is not connected". This error happens when you kill the FUSE process for the parent mount. (See https://github.com/systemd/systemd/issues/9872 )
You can replace the mount -oremount command with sudo ls /root/mnt/mnt. You get the same EACCESS ("Permission denied") error, and the mount point still disappears.
ls /tmp/alan/mnt would also fail due to EACCESS. Notice that the error will be EACCESS even if /tmp/alan/mnt had also been removed, or replaced with a non-directory file.
Normally, if /tmp/alan/mnt had been removed or replaced with a non-directory, the sub-mount /root/mnt/mnt will no longer be valid, and it will be removed automatically. In this case, when the kernel asks sshfs if /root/mnt/mnt still exists as a directory, sshfs just tells it "Permission denied". The kernel treats this as a failure, just like "No such file or directory".
I don't know if that's exactly what happens.
Also sub-mounts don't seem to vanish when ls on the sub-mount returns ENOTCONN "Transport endpoint is not connected". This error happens when you kill the FUSE process for the parent mount. (See https://github.com/systemd/systemd/issues/9872 )
edited Sep 15 at 19:07
answered Aug 14 at 23:51
sourcejedi
20k42883
20k42883
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462638%2fa-sub-mount-which-is-unreachable-due-to-fuse-permissions-disappears-when-access%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password