Thread (16 messages) 16 messages, 2 authors, 2016-08-24
STALE3610d

[PATCH 11/13] btrfs-progs: mkfs: handle and report transaction commit failures

From: David Sterba <dsterba@suse.com>
Date: 2016-08-23 10:43:44
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: David Sterba <dsterba@suse.com>
---
 mkfs.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index c28a8bb7e983..f063323903dc 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1063,7 +1063,11 @@ static int make_image(char *source_dir, struct btrfs_root *root, int out_fd)
 		error("unable to traverse directory %s: %d", source_dir, ret);
 		goto fail;
 	}
-	btrfs_commit_transaction(trans, root);
+	ret = btrfs_commit_transaction(trans, root);
+	if (ret) {
+		error("transaction commit failed: %d", ret);
+		goto out;
+	}
 
 	if (verbose)
 		printf("Making image is completed.\n");
@@ -1784,7 +1788,11 @@ int main(int argc, char **argv)
 		exit(1);
 	}
 
-	btrfs_commit_transaction(trans, root);
+	ret = btrfs_commit_transaction(trans, root);
+	if (ret) {
+		error("unable to commit transaction: %d", ret);
+		goto out;
+	}
 
 	trans = btrfs_start_transaction(root, 1);
 	if (!trans) {
@@ -1858,7 +1866,11 @@ int main(int argc, char **argv)
 		goto out;
 	}
 
-	btrfs_commit_transaction(trans, root);
+	ret = btrfs_commit_transaction(trans, root);
+	if (ret) {
+		error("unable to commit transaction: %d", ret);
+		goto out;
+	}
 
 	if (source_dir_set) {
 		trans = btrfs_start_transaction(root, 1);
-- 
2.7.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help