From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
vkuznets@redhat.com
Cc: Vaughan Cao <vaughan.cao@oracle.com>,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 8/9] hv: hypervvssd: call endmntent before call setmntent again
Date: Tue, 17 Mar 2015 17:42:00 -0700 [thread overview]
Message-ID: <1426639321-25458-8-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1426639321-25458-1-git-send-email-kys@microsoft.com>
From: Vaughan Cao <vaughan.cao@oracle.com>
If freeze fails, vss_operate will re-enter itself to thaw. But it forgets
to call endmntent() before it recalls setmntent() again.
Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
tools/hv/hv_vss_daemon.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 5e63f70..506dd01 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -81,6 +81,7 @@ static int vss_operate(int operation)
char match[] = "/dev/";
FILE *mounts;
struct mntent *ent;
+ char errdir[1024] = {0};
unsigned int cmd;
int error = 0, root_seen = 0, save_errno = 0;
@@ -115,6 +116,8 @@ static int vss_operate(int operation)
goto err;
}
+ endmntent(mounts);
+
if (root_seen) {
error |= vss_do_freeze("/", cmd);
if (error && operation == VSS_OP_FREEZE)
@@ -124,16 +127,19 @@ static int vss_operate(int operation)
goto out;
err:
save_errno = errno;
+ if (ent) {
+ strncpy(errdir, ent->mnt_dir, sizeof(errdir)-1);
+ endmntent(mounts);
+ }
vss_operate(VSS_OP_THAW);
/* Call syslog after we thaw all filesystems */
if (ent)
syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
- ent->mnt_dir, save_errno, strerror(save_errno));
+ errdir, save_errno, strerror(save_errno));
else
syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
strerror(save_errno));
out:
- endmntent(mounts);
return error;
}
--
1.7.4.1
next prev parent reply other threads:[~2015-03-17 23:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 0:41 [PATCH 0/9] Drivers: hv: vmbus: Some miscellaneous fixes K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 1/9] Drivers: hv: vmbus: Perform device register in the per-channel work element K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 2/9] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 3/9] Drivers: hv: hv_balloon: don't lose memory when onlining order is not natural K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 4/9] Correcting truncation error for constant HV_CRASH_CTL_CRASH_NOTIFY K. Y. Srinivasan
2015-03-18 7:26 ` Greg KH
2015-03-18 7:27 ` Greg KH
2015-03-18 14:23 ` KY Srinivasan
2015-03-18 14:26 ` Greg KH
2015-03-18 0:41 ` [PATCH 5/9] hv: vmbus: missing curly braces in vmbus_process_offer() K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 6/9] tools: hv: fcopy_daemon: support >2GB files for x86_32 guest K. Y. Srinivasan
2015-03-18 0:41 ` [PATCH 7/9] Drivers: hv: vmbus: Fix a bug in rescind processing in vmbus_close_internal() K. Y. Srinivasan
2015-03-18 0:42 ` K. Y. Srinivasan [this message]
2015-03-18 0:42 ` [PATCH 9/9] Drivers: hv: vmbus: Export the vmbus_sendpacket_pagebuffer_ctl() K. Y. Srinivasan
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=1426639321-25458-8-git-send-email-kys@microsoft.com \
--to=kys@microsoft.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=vaughan.cao@oracle.com \
--cc=vkuznets@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.