[lxc-devel] [PATCH] fix aufs mount for some fs types via adding the xino parameter

Stéphane Graber stgraber at ubuntu.com
Thu Feb 20 14:32:49 UTC 2014


On Thu, Feb 20, 2014 at 12:49:55AM -0500, S.Çağlar Onur wrote:
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

You're missing a free(rundir); in there and the same change should be
done to lxc-start-ephemeral but I'll take care of those two things.

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

> ---
>  src/lxc/bdev.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index 67fe72b..a06ad52 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -2064,7 +2064,7 @@ static int aufs_detect(const char *path)
>  //
>  static int aufs_mount(struct bdev *bdev)
>  {
> -	char *options, *dup, *lower, *upper;
> +	char *options, *dup, *lower, *upper, *rundir;
>  	int len;
>  	unsigned long mntflags;
>  	char *mntdata;
> @@ -2094,15 +2094,23 @@ static int aufs_mount(struct bdev *bdev)
>  	// TODO We should check whether bdev->src is a blockdev, and if so
>  	// but for now, only support aufs of a basic directory
>  
> +	rundir = get_rundir();
> +	if (!rundir)
> +		return -1;
> +
> +	// AUFS does not work on top of certain filesystems like (XFS or Btrfs)
> +	// so add xino=RUNDIR/lxc/aufs.xino parameter to mount options
> +	//
> +	// see http://www.mail-archive.com/aufs-users@lists.sourceforge.net/msg02587.html
>  	if (mntdata) {
> -		len = strlen(lower) + strlen(upper) + strlen("br==rw:=ro,") + strlen(mntdata) + 1;
> +		len = strlen(lower) + strlen(upper) + strlen(rundir) + strlen("br==rw:=ro,,xino=/lxc/aufs.xino") + strlen(mntdata) + 1;
>  		options = alloca(len);
> -		ret = snprintf(options, len, "br=%s=rw:%s=ro,%s", upper, lower, mntdata);
> +		ret = snprintf(options, len, "br=%s=rw:%s=ro,%s,xino=%s/lxc/aufs.xino", upper, lower, mntdata, rundir);
>  	}
>  	else {
> -		len = strlen(lower) + strlen(upper) + strlen("br==rw:=ro") + 1;
> +		len = strlen(lower) + strlen(upper) + strlen(rundir) + strlen("br==rw:=ro,xino=/lxc/aufs.xino") + 1;
>  		options = alloca(len);
> -		ret = snprintf(options, len, "br=%s=rw:%s=ro", upper, lower);
> +		ret = snprintf(options, len, "br=%s=rw:%s=ro,xino=%s/lxc/aufs.xino", upper, lower, rundir);
>  	}
>  	if (ret < 0 || ret >= len) {
>  		free(mntdata);
> -- 
> 1.8.3.2
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140220/b0eb24d0/attachment.pgp>


More information about the lxc-devel mailing list