]> git.proxmox.com Git - mirror_lxc.git/commitdiff
fix aufs mount for some fs types via adding the xino parameter
authorS.Çağlar Onur <caglar@10ur.org>
Thu, 20 Feb 2014 05:49:55 +0000 (00:49 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 20 Feb 2014 15:22:12 +0000 (10:22 -0500)
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/bdev.c

index ab1c87b35c060b808e6ddc744c33419c0e93c8f9..3357ad2e9be7f55d8d58565dd511a9b78779d4d5 100644 (file)
@@ -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,16 +2094,27 @@ 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);
        }
+
+       free(rundir);
+
        if (ret < 0 || ret >= len) {
                free(mntdata);
                return -1;