Commit 9a09badc by Christian Brauner Committed by Stéphane Graber

check for btrfs fs in should_default_to_snapshot

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: 's avatarChristian Brauner <christian.brauner@mailbox.org> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 7cfe3dd7
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "lxcrsync.h" #include "lxcrsync.h"
#include "utils.h" #include "utils.h"
lxc_log_define(btrfs, lxc); lxc_log_define(lxcbtrfs, lxc);
/* defined in lxccontainer.c: needs to become common helper */ /* defined in lxccontainer.c: needs to become common helper */
extern char *dir_new_path(char *src, const char *oldname, const char *name, extern char *dir_new_path(char *src, const char *oldname, const char *name,
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "lxcrsync.h" #include "lxcrsync.h"
#include "utils.h" #include "utils.h"
lxc_log_define(overlay, lxc); lxc_log_define(lxcoverlay, lxc);
static char *ovl_name; static char *ovl_name;
......
...@@ -2833,6 +2833,10 @@ bool should_default_to_snapshot(struct lxc_container *c0, ...@@ -2833,6 +2833,10 @@ bool should_default_to_snapshot(struct lxc_container *c0,
snprintf(p0, l0, "%s/%s", c0->config_path, c0->name); snprintf(p0, l0, "%s/%s", c0->config_path, c0->name);
snprintf(p1, l1, "%s/%s", c1->config_path, c1->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; return btrfs_same_fs(p0, p1) == 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment