[lxc-devel] [lxc/master] zfs: return error directly when zfs creation fails
brauner on Github
lxc-bot at linuxcontainers.org
Wed Sep 20 08:18:05 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170920/ed235183/attachment.bin>
-------------- next part --------------
From 24f84f1e3142373169ee3f6d1d90b13e6cad65d3 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Wed, 20 Sep 2017 10:13:30 +0200
Subject: [PATCH] zfs: return error directly when zfs creation fails
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/storage/zfs.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lxc/storage/zfs.c b/src/lxc/storage/zfs.c
index 1198fd52b..be90e5a11 100644
--- a/src/lxc/storage/zfs.c
+++ b/src/lxc/storage/zfs.c
@@ -754,12 +754,14 @@ int zfs_create(struct lxc_storage *bdev, const char *dest, const char *n,
cmd_args.argv = argv;
ret = run_command(cmd_output, sizeof(cmd_output),
zfs_create_exec_wrapper, (void *)&cmd_args);
- if (ret < 0)
+ if (ret < 0) {
ERROR("Failed to create zfs dataset \"%s\": %s", bdev->src, cmd_output);
- else if (cmd_output[0] != '\0')
+ return -1;
+ } else if (cmd_output[0] != '\0') {
INFO("Created zfs dataset \"%s\": %s", bdev->src, cmd_output);
- else
+ } else {
TRACE("Created zfs dataset \"%s\"", bdev->src);
+ }
ret = mkdir_p(bdev->dest, 0755);
if (ret < 0 && errno != EEXIST) {
More information about the lxc-devel
mailing list