]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
setup_mount_entries: ignore mount failure if 'optional'
authorSerge Hallyn <serge.hallyn@canonical.com>
Mon, 28 Jan 2013 22:57:24 +0000 (16:57 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 28 Jan 2013 22:59:38 +0000 (17:59 -0500)
If 'optional' is in the mount options, then avoid failure in
mount().

Experiments suggest we could just do this checking data at
mount_entry(), but that feels less proper than using
hasmntopt() against the mntent.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c

index 65cc2dccb5e6019e097c2036202be13d63d139bf..63f5567afcd871cb4fcff46f6de05dbcc5eb8ae5 100644 (file)
@@ -1502,6 +1502,9 @@ static inline int mount_entry_on_systemfs(struct mntent *mntent)
        ret = mount_entry(mntent->mnt_fsname, mntent->mnt_dir,
                          mntent->mnt_type, mntflags, mntdata);
 
+       if (hasmntopt(mntent, "optional") != NULL)
+               ret = 0;
+
        free(mntdata);
 
        return ret;
@@ -1556,6 +1559,9 @@ skipabs:
        ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
                          mntflags, mntdata);
 
+       if (hasmntopt(mntent, "optional") != NULL)
+               ret = 0;
+
 out:
        free(mntdata);
        return ret;
@@ -1584,6 +1590,9 @@ static int mount_entry_on_relative_rootfs(struct mntent *mntent,
        ret = mount_entry(mntent->mnt_fsname, path, mntent->mnt_type,
                          mntflags, mntdata);
 
+       if (hasmntopt(mntent, "optional") != NULL)
+               ret = 0;
+
        free(mntdata);
 
        return ret;