[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1415380170-641-2-git-send-email-vkuznets@redhat.com>
Date: Fri, 7 Nov 2014 18:09:28 +0100
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: devel@...uxdriverproject.org, linux-kernel@...r.kernel.org,
Dexuan Cui <decui@...rosoft.com>
Subject: [PATCH 1/3] Tools: hv: vssdaemon: consult with errno in case of failure only
If ioctl() return 0 there is no point in examining errno and
it can actually produce misleading output. In case there was
no failure errno will contain the error code for previous failure
so user will see the following in the log:
Hyper-V VSS: VSS: freeze of /mnt/udf: Operation not supported
Hyper-V VSS: VSS: freeze of /: Operation not supported
We should also log errors with LOG_ERR instead of LOG_INFO.
Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.com>
---
tools/hv/hv_vss_daemon.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 9ae2b6e..5f67858 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -52,7 +52,11 @@ static int vss_do_freeze(char *dir, unsigned int cmd, char *fs_op)
if (fd < 0)
return 1;
ret = ioctl(fd, cmd, 0);
- syslog(LOG_INFO, "VSS: %s of %s: %s\n", fs_op, dir, strerror(errno));
+ if (ret)
+ syslog(LOG_ERR, "VSS: %s of %s: %s\n", fs_op, dir,
+ strerror(errno));
+ else
+ syslog(LOG_INFO, "VSS: %s of %s succeeded\n", fs_op, dir);
close(fd);
return !!ret;
}
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists