mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	Dexuan Cui <decui@microsoft.com>
Subject: [PATCH 1/3] Tools: hv: vssdaemon: consult with errno in case of failure only
Date: Fri,  7 Nov 2014 18:09:28 +0100	[thread overview]
Message-ID: <1415380170-641-2-git-send-email-vkuznets@redhat.com> (raw)
In-Reply-To: <1415380170-641-1-git-send-email-vkuznets@redhat.com>

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@redhat.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


  reply	other threads:[~2014-11-07 17:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 17:09 [PATCH 0/3] Tools: hv: vssdaemon: freeze/thaw logic improvement for the failure case Vitaly Kuznetsov
2014-11-07 17:09 ` Vitaly Kuznetsov [this message]
2014-11-07 17:09 ` [PATCH 2/3] Tools: hv: vssdaemon: skip all filesystems mounted readonly Vitaly Kuznetsov
2014-11-07 17:09 ` [PATCH 3/3] Tools: hv: vssdaemon: thaw everything in case of freeze failure Vitaly Kuznetsov
2014-11-08  1:07 ` [PATCH 0/3] Tools: hv: vssdaemon: freeze/thaw logic improvement for the failure case Dexuan Cui
2014-11-10 12:30   ` Vitaly Kuznetsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415380170-641-2-git-send-email-vkuznets@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=decui@microsoft.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome