]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
check for btrfs fs in should_default_to_snapshot
authorChristian Brauner <christian.brauner@mailbox.org>
Thu, 14 Jan 2016 20:39:05 +0000 (21:39 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 28 Jan 2016 10:58:57 +0000 (11:58 +0100)
Check if we're really on a btrfs filesystem before we call btrfs_same_fs().
Otherwise we will report misleading errors although everything went fine.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/bdev/lxcbtrfs.c
src/lxc/bdev/lxcoverlay.c
src/lxc/lxccontainer.c

index 2db7c87cb7eec445a7f9bb879e1d6af99c7705f0..80b22fd8597cfd9e9406a62afb02797ee30bf49e 100644 (file)
@@ -40,7 +40,7 @@
 #include "lxcrsync.h"
 #include "utils.h"
 
-lxc_log_define(btrfs, lxc);
+lxc_log_define(lxcbtrfs, lxc);
 
 /* defined in lxccontainer.c: needs to become common helper */
 extern char *dir_new_path(char *src, const char *oldname, const char *name,
index d06d24f511b4d2fed4a8fa3b84cfd72beb15226f..4d30f3ce0eb9cd0539fdcb6a7732c669a660e2fd 100644 (file)
@@ -36,7 +36,7 @@
 #include "lxcrsync.h"
 #include "utils.h"
 
-lxc_log_define(overlay, lxc);
+lxc_log_define(lxcoverlay, lxc);
 
 static char *ovl_name;
 
index 490a59ddd74b6074dcaa7423a8604105773c7dc3..7f2a390202c8a03a9855538276c93419861a7edf 100644 (file)
@@ -2833,6 +2833,10 @@ bool should_default_to_snapshot(struct lxc_container *c0,
 
        snprintf(p0, l0, "%s/%s", c0->config_path, c0->name);
        snprintf(p1, l1, "%s/%s", c1->config_path, c1->name);
+
+       if (!is_btrfs_fs(p0) || !is_btrfs_fs(p1))
+               return false;
+
        return btrfs_same_fs(p0, p1) == 0;
 }