aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorVaughan Cao <vaughan.cao@oracle.com>2015-03-18 15:29:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-25 06:53:54 -0400
commit4ce50e9491c5c92baf8bb7af85eb25398d3f70af (patch)
tree0cfe0543c07c8c41632df69b10a5d95d7035d8a3 /tools
parentf2eddbc9f1a466329c68f3b75e89cfacd2792365 (diff)
hv: hypervvssd: call endmntent before call setmntent again
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/hv/hv_vss_daemon.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index 5e63f70bd956..506dd0148828 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)
81 char match[] = "/dev/"; 81 char match[] = "/dev/";
82 FILE *mounts; 82 FILE *mounts;
83 struct mntent *ent; 83 struct mntent *ent;
84 char errdir[1024] = {0};
84 unsigned int cmd; 85 unsigned int cmd;
85 int error = 0, root_seen = 0, save_errno = 0; 86 int error = 0, root_seen = 0, save_errno = 0;
86 87
@@ -115,6 +116,8 @@ static int vss_operate(int operation)
115 goto err; 116 goto err;
116 } 117 }
117 118
119 endmntent(mounts);
120
118 if (root_seen) { 121 if (root_seen) {
119 error |= vss_do_freeze("/", cmd); 122 error |= vss_do_freeze("/", cmd);
120 if (error && operation == VSS_OP_FREEZE) 123 if (error && operation == VSS_OP_FREEZE)
@@ -124,16 +127,19 @@ static int vss_operate(int operation)
124 goto out; 127 goto out;
125err: 128err:
126 save_errno = errno; 129 save_errno = errno;
130 if (ent) {
131 strncpy(errdir, ent->mnt_dir, sizeof(errdir)-1);
132 endmntent(mounts);
133 }
127 vss_operate(VSS_OP_THAW); 134 vss_operate(VSS_OP_THAW);
128 /* Call syslog after we thaw all filesystems */ 135 /* Call syslog after we thaw all filesystems */
129 if (ent) 136 if (ent)
130 syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s", 137 syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
131 ent->mnt_dir, save_errno, strerror(save_errno)); 138 errdir, save_errno, strerror(save_errno));
132 else 139 else
133 syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno, 140 syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
134 strerror(save_errno)); 141 strerror(save_errno));
135out: 142out:
136 endmntent(mounts);
137 return error; 143 return error;
138} 144}
139 145