Otherwise mount may return -EINVAL if in-kernel super-block parser objects (as is the case with ext4).
We may want to specifically look for create=file and create=dir, in case create=sniggly becomes a real mount option for some fs... Signed-off-by: Serge Hallyn <[email protected]> --- src/lxc/conf.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index d40e3e0..c93403a 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1881,7 +1881,25 @@ static int mount_entry(const char *fsname, const char *target, return 0; } -static inline int mount_entry_on_systemfs(const struct mntent *mntent) +/* + * Remove 'create=dir' or 'create=file' from mntopt + */ +static void cull_mntent_opt(struct mntent *mntent) +{ + char *p, *p2; + + while ((p = strstr(mntent->mnt_opts, "create="))) { + p2 = strchr(p, ','); + if (!p2) { + /* no more mntopts, so just chop it here */ + *p = '\0'; + return; + } + memmove(p2+1, p, strlen(p2+1)+1); + } +} + +static inline int mount_entry_on_systemfs(struct mntent *mntent) { unsigned long mntflags; char *mntdata; @@ -1911,6 +1929,8 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent) fclose(pathfile); } + cull_mntent_opt(mntent); + if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) { free(mntdata); return -1; @@ -1928,7 +1948,7 @@ static inline int mount_entry_on_systemfs(const struct mntent *mntent) return ret; } -static int mount_entry_on_absolute_rootfs(const struct mntent *mntent, +static int mount_entry_on_absolute_rootfs(struct mntent *mntent, const struct lxc_rootfs *rootfs, const char *lxc_name) { @@ -1998,6 +2018,7 @@ skipabs: else fclose(pathfile); } + cull_mntent_opt(mntent); if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) { free(mntdata); @@ -2017,7 +2038,7 @@ out: return ret; } -static int mount_entry_on_relative_rootfs(const struct mntent *mntent, +static int mount_entry_on_relative_rootfs(struct mntent *mntent, const char *rootfs) { char path[MAXPATHLEN]; @@ -2055,6 +2076,7 @@ static int mount_entry_on_relative_rootfs(const struct mntent *mntent, else fclose(pathfile); } + cull_mntent_opt(mntent); if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) { free(mntdata); -- 1.9.rc1 _______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
