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

The name of the pictureThe name of the pictureThe name of the pictureClash 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)









share|improve this question



























    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)









    share|improve this question

























      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)









      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 15 at 0:16

























      asked Aug 14 at 23:51









      sourcejedi

      20k42883




      20k42883




















          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 )






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            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






























            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 )






            share|improve this answer


























              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 )






              share|improve this answer
























                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 )






                share|improve this answer














                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 )







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Sep 15 at 19:07

























                answered Aug 14 at 23:51









                sourcejedi

                20k42883




                20k42883



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)