aboutsummaryrefslogtreecommitdiffstats
path: root/tools/hv
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2014-11-10 11:37:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-26 22:01:11 -0500
commit7a401744d517864f8f2f2afba589e58a71d03aa6 (patch)
tree4b1a2b01a8d77ff27dfbe6779f4eb65c6a47a757 /tools/hv
parent8d9560ebcc6448472b3afe8f36f37d6b0de8f5a4 (diff)
Tools: hv: vssdaemon: report freeze errors
When ioctl(fd, FIFREEZE, 0) results in an error we cannot report it to syslog instantly since that can cause write to a frozen disk. However, the name of the filesystem which caused the error and errno are valuable and we would like to get a nice human-readable message in the log. Save errno before calling vss_operate(VSS_OP_THAW) and report the error right after. Unfortunately, FITHAW errors cannot be reported the same way as we need to finish thawing all filesystems before calling syslog(). We should also avoid calling endmntent() for the second time in case we encountered an error during freezing of '/' as it usually results in SEGSEGV. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Acked-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/hv')
-rw-r--r--tools/hv/hv_vss_daemon.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c
index b720d8f0f901..ee44f0d730ef 100644
--- a/tools/hv/hv_vss_daemon.c
+++ b/tools/hv/hv_vss_daemon.c
@@ -82,7 +82,7 @@ static int vss_operate(int operation)
82 FILE *mounts; 82 FILE *mounts;
83 struct mntent *ent; 83 struct mntent *ent;
84 unsigned int cmd; 84 unsigned int cmd;
85 int error = 0, root_seen = 0; 85 int error = 0, root_seen = 0, save_errno = 0;
86 86
87 switch (operation) { 87 switch (operation) {
88 case VSS_OP_FREEZE: 88 case VSS_OP_FREEZE:
@@ -114,7 +114,6 @@ static int vss_operate(int operation)
114 if (error && operation == VSS_OP_FREEZE) 114 if (error && operation == VSS_OP_FREEZE)
115 goto err; 115 goto err;
116 } 116 }
117 endmntent(mounts);
118 117
119 if (root_seen) { 118 if (root_seen) {
120 error |= vss_do_freeze("/", cmd); 119 error |= vss_do_freeze("/", cmd);
@@ -122,10 +121,19 @@ static int vss_operate(int operation)
122 goto err; 121 goto err;
123 } 122 }
124 123
125 return error; 124 goto out;
126err: 125err:
127 endmntent(mounts); 126 save_errno = errno;
128 vss_operate(VSS_OP_THAW); 127 vss_operate(VSS_OP_THAW);
128 /* Call syslog after we thaw all filesystems */
129 if (ent)
130 syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
131 ent->mnt_dir, save_errno, strerror(save_errno));
132 else
133 syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
134 strerror(save_errno));
135out:
136 endmntent(mounts);
129 return error; 137 return error;
130} 138}
131 139