mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-03 02:27:45 +00:00
lxc to apply mount options for bind mounts
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. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
a7dff83460
commit
e76b8764fa
@ -799,12 +799,28 @@ static int mount_file_entries(FILE *file)
|
||||
}
|
||||
|
||||
if (mount(mntent->mnt_fsname, mntent->mnt_dir,
|
||||
mntent->mnt_type, mntflags, mntdata)) {
|
||||
mntent->mnt_type, mntflags & ~MS_REMOUNT, mntdata)) {
|
||||
SYSERROR("failed to mount '%s' on '%s'",
|
||||
mntent->mnt_fsname, mntent->mnt_dir);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((mntflags & MS_REMOUNT) == MS_REMOUNT ||
|
||||
((mntflags & MS_BIND) == MS_BIND)) {
|
||||
|
||||
DEBUG ("remounting %s on %s to respect bind " \
|
||||
"or remount options",
|
||||
mntent->mnt_fsname, mntent->mnt_dir);
|
||||
|
||||
if (mount(mntent->mnt_fsname, mntent->mnt_dir,
|
||||
mntent->mnt_type,
|
||||
mntflags | MS_REMOUNT, mntdata)) {
|
||||
SYSERROR("failed to mount '%s' on '%s'",
|
||||
mntent->mnt_fsname, mntent->mnt_dir);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG("mounted %s on %s, type %s", mntent->mnt_fsname,
|
||||
mntent->mnt_dir, mntent->mnt_type);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user