[lxc-devel] [PATCH] setup_mount_entries: ignore mount failure if 'optional'

Stéphane Graber stgraber at ubuntu.com
Mon Jan 28 23:00:41 UTC 2013


On 01/28/2013 05:57 PM, Serge Hallyn wrote:
> 
> 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.

Now, that's the kind of patch I like to review ;)

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

Pushed to staging. Thanks

> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> ---
>  src/lxc/conf.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 65cc2dc..63f5567 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -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;
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130128/e307fa60/attachment.pgp>


More information about the lxc-devel mailing list