[lxc-devel] Fixed (hacked) LXC to apply mount options for bind mounts

Daniel Lezcano daniel.lezcano at free.fr
Wed Jun 23 21:00:41 UTC 2010


On 03/08/2010 10:35 PM, Ciprian Dorin, Craciun wrote:
>      Hello all!
>
>      This bug stalked me for a while, but only now it bit me quite
> badly... (Lost about an hour of work...)
>
>      So the culprit: inside the fstab file for the `lxc.mount` option I
> can use options like `ro` together with `bind`. Unfortunately the
> kernel just laughs in my face and ignores any options I've put in
> there... :) But not any more: I've updated `./src/lxc/conf.c`
> (`mount_file_entries` function) so that when it encounters a `bind`
> option it executes it twice (one without any extra options, and a
> second time with the remount flag set.)
>
>      I've marginally (as in my particular case) tested it and it works.
>
>      Any other ideas on how to solve this? Any comments?
>      Ciprian.
>    

Sorry for the delay. Hopefully, John remind me to take this patch.

I found this paragraph in the mount man page:

"
[ ... ]
Note that the filesystem mount options will remain the same as those on 
the original mount point, and cannot be  changed  by  passing  the  -o 
option along with --bind/--rbind. The mount options can be changed by a 
separate remount command, for example:

                      mount --bind olddir newdir
                      mount -o remount,ro newdir
"

So I think your patch is correct :)

Thanks Ciprian.

   -- Daniel




More information about the lxc-devel mailing list