Unverified Commit 0dbe6379 by Li Feng Committed by Stéphane Graber

Using 'add-required_remount_flags' function to add required flags

Signed-off-by: 's avatarLi Feng <lifeng68@huawei.com>
parent cb9b4e09
......@@ -135,6 +135,7 @@ int dir_mount(struct bdev *bdev)
unsigned long mntflags;
char *src, *mntdata;
int ret;
unsigned long mflags;
if (strcmp(bdev->type, "dir"))
return -22;
......@@ -153,7 +154,8 @@ int dir_mount(struct bdev *bdev)
if ((0 == ret) && (mntflags & MS_RDONLY)) {
DEBUG("remounting %s on %s with readonly options",
src ? src : "(none)", bdev->dest ? bdev->dest : "(none)");
ret = mount(src, bdev->dest, "bind", MS_BIND | MS_REC | mntflags | MS_REMOUNT, mntdata);
mflags = add_required_remount_flags(src, bdev->dest, MS_BIND | MS_REC | mntflags | MS_REMOUNT);
ret = mount(src, bdev->dest, "bind", mflags, mntdata);
}
free(mntdata);
......
......@@ -569,7 +569,7 @@ int pin_rootfs(const char *rootfs)
* If we are asking to remount something, make sure that any
* NOEXEC etc are honored.
*/
static unsigned long add_required_remount_flags(const char *s, const char *d,
unsigned long add_required_remount_flags(const char *s, const char *d,
unsigned long flags)
{
#ifdef HAVE_STATVFS
......
......@@ -451,4 +451,7 @@ void remount_all_slave(void);
extern void suggest_default_idmap(void);
FILE *make_anonymous_mount_file(struct lxc_list *mount);
struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings);
unsigned long add_required_remount_flags(const char *s, const char *d,
unsigned long flags);
#endif
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