Commit e76b8764 by Ciprian Dorin, Craciun Committed by Daniel Lezcano

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent a7dff834
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment