summaryrefslogtreecommitdiff
path: root/convert
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2018-01-11 15:44:55 +0000
committerDimitri John Ledkov <xnox@ubuntu.com>2018-01-11 15:44:55 +0000
commitd78d642bffff6ea49d62c19f26052ed6d3dcc467 (patch)
treedb0f470018ee6f4b93fb8fd601401fa157e5dbe3 /convert
parentb309a4dfbe8130b9fef087df59dd18a487a9c18e (diff)
New upstream release.
Diffstat (limited to 'convert')
-rw-r--r--convert/main.c12
-rw-r--r--convert/source-fs.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/convert/main.c b/convert/main.c
index 882daf7c..89f92611 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -768,7 +768,7 @@ static int create_image(struct btrfs_root *root,
if (ret < 0)
goto out;
ret = btrfs_add_link(trans, root, ino, BTRFS_FIRST_FREE_OBJECTID, name,
- strlen(name), BTRFS_FT_REG_FILE, NULL, 1);
+ strlen(name), BTRFS_FT_REG_FILE, NULL, 1, 0);
if (ret < 0)
goto out;
@@ -1443,6 +1443,8 @@ next:
}
}
btrfs_release_path(&path);
+ if (ret)
+ return ret;
/*
* For HOLES mode (without NO_HOLES), we must ensure file extents
* cover the whole range of the image
@@ -1529,7 +1531,13 @@ static int do_rollback(const char *devname)
goto free_mem;
}
fsize = lseek(fd, 0, SEEK_END);
- root = open_ctree_fd(fd, devname, 0, OPEN_CTREE_WRITES);
+
+ /*
+ * For rollback, we don't really need to write anything so open it
+ * read-only. The write part will happen after we close the
+ * filesystem.
+ */
+ root = open_ctree_fd(fd, devname, 0, 0);
if (!root) {
error("unable to open ctree");
ret = -EIO;
diff --git a/convert/source-fs.h b/convert/source-fs.h
index 23f33567..4e5babef 100644
--- a/convert/source-fs.h
+++ b/convert/source-fs.h
@@ -19,6 +19,7 @@
#include "kerncompat.h"
#include <linux/kdev_t.h>
+#include <sys/types.h>
#include <pthread.h>
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID