MS_BIND flag on / folder not working

Prabhunath G gprabhunath at gmail.com
Wed Mar 8 04:56:23 EST 2017


Hi All,

         Binding / folder onto someother folder say /opt/lxc is not working
but otherway round is working. Can I get some help on this.

The following code snippet is executed after cloning
After executing the following code snippet the contents of / is visible in
/opt/lxc
      ret = mount("/", "/opt/lxc", NULL, MS_BIND, NULL);
      if (ret) {
        perror("mount bind / on /opt/lxc");
        exit(1);
     }

But after executing the following code snippet the contents of /opt/lxc is
not visible in /
      ret = mount("/opt/lxc", "/", NULL, MS_BIND, NULL);
      if (ret) {
        perror("mount bind /opt/lxc on /");
        exit(1);
     }

The code is executing successfully, but the result is not as expected.

Regards,
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170308/b09e5896/attachment.html 


More information about the Kernelnewbies mailing list