Unverified Commit d21aa4fa by Li Feng Committed by Stéphane Graber

Fix issue #1702, do remount with the MS_REMOUNT flag when mounts with MS_RDONLY

Signed-off-by: 's avatarLi Feng <lifeng68@huawei.com>
parent 8273498c
...@@ -150,6 +150,12 @@ int dir_mount(struct bdev *bdev) ...@@ -150,6 +150,12 @@ int dir_mount(struct bdev *bdev)
src = lxc_storage_get_path(bdev->src, bdev->type); src = lxc_storage_get_path(bdev->src, bdev->type);
ret = mount(src, bdev->dest, "bind", MS_BIND | MS_REC | mntflags, mntdata); ret = mount(src, bdev->dest, "bind", MS_BIND | MS_REC | mntflags, mntdata);
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);
}
free(mntdata); free(mntdata);
return ret; return ret;
} }
......
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