K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * An implementation of the host initiated guest snapshot for Hyper-V. |
| 3 | * |
| 4 | * |
| 5 | * Copyright (C) 2013, Microsoft, Inc. |
| 6 | * Author : K. Y. Srinivasan <kys@microsoft.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 2 as published |
| 10 | * by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 15 | * NON INFRINGEMENT. See the GNU General Public License for more |
| 16 | * details. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #include <sys/types.h> |
| 22 | #include <sys/socket.h> |
| 23 | #include <sys/poll.h> |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 24 | #include <sys/ioctl.h> |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 25 | #include <fcntl.h> |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 26 | #include <stdio.h> |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 27 | #include <mntent.h> |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 28 | #include <stdlib.h> |
| 29 | #include <unistd.h> |
| 30 | #include <string.h> |
| 31 | #include <ctype.h> |
| 32 | #include <errno.h> |
| 33 | #include <arpa/inet.h> |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 34 | #include <linux/fs.h> |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 35 | #include <linux/connector.h> |
| 36 | #include <linux/hyperv.h> |
| 37 | #include <linux/netlink.h> |
| 38 | #include <syslog.h> |
Vitaly Kuznetsov | 170f4be | 2014-10-22 18:07:11 +0200 | [diff] [blame] | 39 | #include <getopt.h> |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 40 | |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 41 | static struct sockaddr_nl addr; |
| 42 | |
| 43 | #ifndef SOL_NETLINK |
| 44 | #define SOL_NETLINK 270 |
| 45 | #endif |
| 46 | |
| 47 | |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 48 | /* Don't use syslog() in the function since that can cause write to disk */ |
| 49 | static int vss_do_freeze(char *dir, unsigned int cmd) |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 50 | { |
| 51 | int ret, fd = open(dir, O_RDONLY); |
| 52 | |
| 53 | if (fd < 0) |
| 54 | return 1; |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 55 | |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 56 | ret = ioctl(fd, cmd, 0); |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * If a partition is mounted more than once, only the first |
| 60 | * FREEZE/THAW can succeed and the later ones will get |
| 61 | * EBUSY/EINVAL respectively: there could be 2 cases: |
| 62 | * 1) a user may mount the same partition to differnt directories |
| 63 | * by mistake or on purpose; |
| 64 | * 2) The subvolume of btrfs appears to have the same partition |
| 65 | * mounted more than once. |
| 66 | */ |
| 67 | if (ret) { |
| 68 | if ((cmd == FIFREEZE && errno == EBUSY) || |
| 69 | (cmd == FITHAW && errno == EINVAL)) { |
| 70 | close(fd); |
| 71 | return 0; |
| 72 | } |
| 73 | } |
| 74 | |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 75 | close(fd); |
| 76 | return !!ret; |
| 77 | } |
| 78 | |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 79 | static int vss_operate(int operation) |
| 80 | { |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 81 | char match[] = "/dev/"; |
| 82 | FILE *mounts; |
| 83 | struct mntent *ent; |
Vaughan Cao | 4ce50e9 | 2015-03-18 12:29:28 -0700 | [diff] [blame] | 84 | char errdir[1024] = {0}; |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 85 | unsigned int cmd; |
Vitaly Kuznetsov | 7a40174 | 2014-11-10 17:37:01 +0100 | [diff] [blame] | 86 | int error = 0, root_seen = 0, save_errno = 0; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 87 | |
| 88 | switch (operation) { |
| 89 | case VSS_OP_FREEZE: |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 90 | cmd = FIFREEZE; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 91 | break; |
| 92 | case VSS_OP_THAW: |
Olaf Hering | 7b413b6 | 2013-04-24 07:48:52 -0700 | [diff] [blame] | 93 | cmd = FITHAW; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 94 | break; |
Olaf Hering | eb8905b | 2013-04-24 07:48:48 -0700 | [diff] [blame] | 95 | default: |
| 96 | return -1; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 97 | } |
| 98 | |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 99 | mounts = setmntent("/proc/mounts", "r"); |
| 100 | if (mounts == NULL) |
Olaf Hering | eb8905b | 2013-04-24 07:48:48 -0700 | [diff] [blame] | 101 | return -1; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 102 | |
K. Y. Srinivasan | 0e27263 | 2013-04-24 07:48:54 -0700 | [diff] [blame] | 103 | while ((ent = getmntent(mounts))) { |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 104 | if (strncmp(ent->mnt_fsname, match, strlen(match))) |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 105 | continue; |
Vitaly Kuznetsov | 9e5db05 | 2014-11-10 17:37:02 +0100 | [diff] [blame] | 106 | if (hasmntopt(ent, MNTOPT_RO) != NULL) |
Olaf Hering | 10b637b | 2013-04-24 07:48:53 -0700 | [diff] [blame] | 107 | continue; |
K. Y. Srinivasan | f33b215 | 2014-02-12 08:40:22 -0800 | [diff] [blame] | 108 | if (strcmp(ent->mnt_type, "vfat") == 0) |
| 109 | continue; |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 110 | if (strcmp(ent->mnt_dir, "/") == 0) { |
| 111 | root_seen = 1; |
| 112 | continue; |
| 113 | } |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 114 | error |= vss_do_freeze(ent->mnt_dir, cmd); |
| 115 | if (error && operation == VSS_OP_FREEZE) |
| 116 | goto err; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 117 | } |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 118 | |
Vaughan Cao | 4ce50e9 | 2015-03-18 12:29:28 -0700 | [diff] [blame] | 119 | endmntent(mounts); |
| 120 | |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 121 | if (root_seen) { |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 122 | error |= vss_do_freeze("/", cmd); |
| 123 | if (error && operation == VSS_OP_FREEZE) |
| 124 | goto err; |
Olaf Hering | d3d1ee3 | 2013-04-24 07:48:51 -0700 | [diff] [blame] | 125 | } |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 126 | |
Vitaly Kuznetsov | 7a40174 | 2014-11-10 17:37:01 +0100 | [diff] [blame] | 127 | goto out; |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 128 | err: |
Vitaly Kuznetsov | 7a40174 | 2014-11-10 17:37:01 +0100 | [diff] [blame] | 129 | save_errno = errno; |
Vaughan Cao | 4ce50e9 | 2015-03-18 12:29:28 -0700 | [diff] [blame] | 130 | if (ent) { |
| 131 | strncpy(errdir, ent->mnt_dir, sizeof(errdir)-1); |
| 132 | endmntent(mounts); |
| 133 | } |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 134 | vss_operate(VSS_OP_THAW); |
Vitaly Kuznetsov | 7a40174 | 2014-11-10 17:37:01 +0100 | [diff] [blame] | 135 | /* Call syslog after we thaw all filesystems */ |
| 136 | if (ent) |
| 137 | syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s", |
Vaughan Cao | 4ce50e9 | 2015-03-18 12:29:28 -0700 | [diff] [blame] | 138 | errdir, save_errno, strerror(save_errno)); |
Vitaly Kuznetsov | 7a40174 | 2014-11-10 17:37:01 +0100 | [diff] [blame] | 139 | else |
| 140 | syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno, |
| 141 | strerror(save_errno)); |
| 142 | out: |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 143 | return error; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | static int netlink_send(int fd, struct cn_msg *msg) |
| 147 | { |
Olaf Hering | b4fb0ca | 2013-08-07 15:45:12 +0200 | [diff] [blame] | 148 | struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE }; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 149 | unsigned int size; |
| 150 | struct msghdr message; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 151 | struct iovec iov[2]; |
| 152 | |
Olaf Hering | 2bc41ea | 2013-08-07 15:07:21 +0200 | [diff] [blame] | 153 | size = sizeof(struct cn_msg) + msg->len; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 154 | |
Olaf Hering | b4fb0ca | 2013-08-07 15:45:12 +0200 | [diff] [blame] | 155 | nlh.nlmsg_pid = getpid(); |
| 156 | nlh.nlmsg_len = NLMSG_LENGTH(size); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 157 | |
Olaf Hering | b4fb0ca | 2013-08-07 15:45:12 +0200 | [diff] [blame] | 158 | iov[0].iov_base = &nlh; |
| 159 | iov[0].iov_len = sizeof(nlh); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 160 | |
| 161 | iov[1].iov_base = msg; |
| 162 | iov[1].iov_len = size; |
| 163 | |
| 164 | memset(&message, 0, sizeof(message)); |
| 165 | message.msg_name = &addr; |
| 166 | message.msg_namelen = sizeof(addr); |
| 167 | message.msg_iov = iov; |
| 168 | message.msg_iovlen = 2; |
| 169 | |
| 170 | return sendmsg(fd, &message, 0); |
| 171 | } |
| 172 | |
Vitaly Kuznetsov | 170f4be | 2014-10-22 18:07:11 +0200 | [diff] [blame] | 173 | void print_usage(char *argv[]) |
| 174 | { |
| 175 | fprintf(stderr, "Usage: %s [options]\n" |
| 176 | "Options are:\n" |
| 177 | " -n, --no-daemon stay in foreground, don't daemonize\n" |
| 178 | " -h, --help print this help\n", argv[0]); |
| 179 | } |
| 180 | |
| 181 | int main(int argc, char *argv[]) |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 182 | { |
| 183 | int fd, len, nl_group; |
| 184 | int error; |
| 185 | struct cn_msg *message; |
| 186 | struct pollfd pfd; |
| 187 | struct nlmsghdr *incoming_msg; |
| 188 | struct cn_msg *incoming_cn_msg; |
| 189 | int op; |
| 190 | struct hv_vss_msg *vss_msg; |
Olaf Hering | b4919a5 | 2013-08-01 14:34:26 +0200 | [diff] [blame] | 191 | char *vss_recv_buffer; |
| 192 | size_t vss_recv_buffer_len; |
Vitaly Kuznetsov | 170f4be | 2014-10-22 18:07:11 +0200 | [diff] [blame] | 193 | int daemonize = 1, long_index = 0, opt; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 194 | |
Vitaly Kuznetsov | 170f4be | 2014-10-22 18:07:11 +0200 | [diff] [blame] | 195 | static struct option long_options[] = { |
| 196 | {"help", no_argument, 0, 'h' }, |
| 197 | {"no-daemon", no_argument, 0, 'n' }, |
| 198 | {0, 0, 0, 0 } |
| 199 | }; |
| 200 | |
| 201 | while ((opt = getopt_long(argc, argv, "hn", long_options, |
| 202 | &long_index)) != -1) { |
| 203 | switch (opt) { |
| 204 | case 'n': |
| 205 | daemonize = 0; |
| 206 | break; |
| 207 | case 'h': |
| 208 | default: |
| 209 | print_usage(argv); |
| 210 | exit(EXIT_FAILURE); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | if (daemonize && daemon(1, 0)) |
Olaf Hering | eb8905b | 2013-04-24 07:48:48 -0700 | [diff] [blame] | 215 | return 1; |
| 216 | |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 217 | openlog("Hyper-V VSS", 0, LOG_USER); |
| 218 | syslog(LOG_INFO, "VSS starting; pid is:%d", getpid()); |
| 219 | |
Olaf Hering | 269ce62 | 2013-08-06 20:55:38 +0200 | [diff] [blame] | 220 | vss_recv_buffer_len = NLMSG_LENGTH(0) + sizeof(struct cn_msg) + sizeof(struct hv_vss_msg); |
Olaf Hering | b4919a5 | 2013-08-01 14:34:26 +0200 | [diff] [blame] | 221 | vss_recv_buffer = calloc(1, vss_recv_buffer_len); |
Olaf Hering | 269ce62 | 2013-08-06 20:55:38 +0200 | [diff] [blame] | 222 | if (!vss_recv_buffer) { |
Olaf Hering | b4919a5 | 2013-08-01 14:34:26 +0200 | [diff] [blame] | 223 | syslog(LOG_ERR, "Failed to allocate netlink buffers"); |
| 224 | exit(EXIT_FAILURE); |
| 225 | } |
| 226 | |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 227 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); |
| 228 | if (fd < 0) { |
Tomas Hozza | 5c28926 | 2013-06-27 13:52:47 +0200 | [diff] [blame] | 229 | syslog(LOG_ERR, "netlink socket creation failed; error:%d %s", |
| 230 | errno, strerror(errno)); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 231 | exit(EXIT_FAILURE); |
| 232 | } |
| 233 | addr.nl_family = AF_NETLINK; |
| 234 | addr.nl_pad = 0; |
| 235 | addr.nl_pid = 0; |
| 236 | addr.nl_groups = 0; |
| 237 | |
| 238 | |
| 239 | error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); |
| 240 | if (error < 0) { |
Tomas Hozza | 5c28926 | 2013-06-27 13:52:47 +0200 | [diff] [blame] | 241 | syslog(LOG_ERR, "bind failed; error:%d %s", errno, strerror(errno)); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 242 | close(fd); |
| 243 | exit(EXIT_FAILURE); |
| 244 | } |
| 245 | nl_group = CN_VSS_IDX; |
Tomas Hozza | d12e146 | 2013-06-27 13:52:48 +0200 | [diff] [blame] | 246 | if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) { |
| 247 | syslog(LOG_ERR, "setsockopt failed; error:%d %s", errno, strerror(errno)); |
| 248 | close(fd); |
| 249 | exit(EXIT_FAILURE); |
| 250 | } |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 251 | /* |
| 252 | * Register ourselves with the kernel. |
| 253 | */ |
Olaf Hering | 269ce62 | 2013-08-06 20:55:38 +0200 | [diff] [blame] | 254 | message = (struct cn_msg *)vss_recv_buffer; |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 255 | message->id.idx = CN_VSS_IDX; |
| 256 | message->id.val = CN_VSS_VAL; |
| 257 | message->ack = 0; |
| 258 | vss_msg = (struct hv_vss_msg *)message->data; |
| 259 | vss_msg->vss_hdr.operation = VSS_OP_REGISTER; |
| 260 | |
| 261 | message->len = sizeof(struct hv_vss_msg); |
| 262 | |
| 263 | len = netlink_send(fd, message); |
| 264 | if (len < 0) { |
Tomas Hozza | 5c28926 | 2013-06-27 13:52:47 +0200 | [diff] [blame] | 265 | syslog(LOG_ERR, "netlink_send failed; error:%d %s", errno, strerror(errno)); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 266 | close(fd); |
| 267 | exit(EXIT_FAILURE); |
| 268 | } |
| 269 | |
| 270 | pfd.fd = fd; |
| 271 | |
| 272 | while (1) { |
| 273 | struct sockaddr *addr_p = (struct sockaddr *) &addr; |
| 274 | socklen_t addr_l = sizeof(addr); |
| 275 | pfd.events = POLLIN; |
| 276 | pfd.revents = 0; |
Tomas Hozza | 9561d47 | 2013-06-27 13:52:49 +0200 | [diff] [blame] | 277 | |
| 278 | if (poll(&pfd, 1, -1) < 0) { |
| 279 | syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno)); |
| 280 | if (errno == EINVAL) { |
| 281 | close(fd); |
| 282 | exit(EXIT_FAILURE); |
| 283 | } |
| 284 | else |
| 285 | continue; |
| 286 | } |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 287 | |
Olaf Hering | b4919a5 | 2013-08-01 14:34:26 +0200 | [diff] [blame] | 288 | len = recvfrom(fd, vss_recv_buffer, vss_recv_buffer_len, 0, |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 289 | addr_p, &addr_l); |
| 290 | |
Olaf Hering | 5edf5ee | 2013-04-24 07:48:49 -0700 | [diff] [blame] | 291 | if (len < 0) { |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 292 | syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", |
| 293 | addr.nl_pid, errno, strerror(errno)); |
| 294 | close(fd); |
| 295 | return -1; |
| 296 | } |
| 297 | |
Olaf Hering | 5edf5ee | 2013-04-24 07:48:49 -0700 | [diff] [blame] | 298 | if (addr.nl_pid) { |
K. Y. Srinivasan | 038336a | 2013-04-24 07:48:50 -0700 | [diff] [blame] | 299 | syslog(LOG_WARNING, |
| 300 | "Received packet from untrusted pid:%u", |
| 301 | addr.nl_pid); |
Olaf Hering | 5edf5ee | 2013-04-24 07:48:49 -0700 | [diff] [blame] | 302 | continue; |
| 303 | } |
| 304 | |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 305 | incoming_msg = (struct nlmsghdr *)vss_recv_buffer; |
| 306 | |
| 307 | if (incoming_msg->nlmsg_type != NLMSG_DONE) |
| 308 | continue; |
| 309 | |
| 310 | incoming_cn_msg = (struct cn_msg *)NLMSG_DATA(incoming_msg); |
| 311 | vss_msg = (struct hv_vss_msg *)incoming_cn_msg->data; |
| 312 | op = vss_msg->vss_hdr.operation; |
| 313 | error = HV_S_OK; |
| 314 | |
| 315 | switch (op) { |
| 316 | case VSS_OP_FREEZE: |
| 317 | case VSS_OP_THAW: |
| 318 | error = vss_operate(op); |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 319 | syslog(LOG_INFO, "VSS: op=%s: %s\n", |
| 320 | op == VSS_OP_FREEZE ? "FREEZE" : "THAW", |
| 321 | error ? "failed" : "succeeded"); |
| 322 | |
| 323 | if (error) { |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 324 | error = HV_E_FAIL; |
Dexuan Cui | 4f68919 | 2014-09-25 21:52:04 -0700 | [diff] [blame] | 325 | syslog(LOG_ERR, "op=%d failed!", op); |
| 326 | syslog(LOG_ERR, "report it with these files:"); |
| 327 | syslog(LOG_ERR, "/etc/fstab and /proc/mounts"); |
| 328 | } |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 329 | break; |
| 330 | default: |
| 331 | syslog(LOG_ERR, "Illegal op:%d\n", op); |
| 332 | } |
| 333 | vss_msg->error = error; |
| 334 | len = netlink_send(fd, incoming_cn_msg); |
| 335 | if (len < 0) { |
Tomas Hozza | 5c28926 | 2013-06-27 13:52:47 +0200 | [diff] [blame] | 336 | syslog(LOG_ERR, "net_link send failed; error:%d %s", |
| 337 | errno, strerror(errno)); |
K. Y. Srinivasan | 96dd86f | 2013-03-15 12:30:06 -0700 | [diff] [blame] | 338 | exit(EXIT_FAILURE); |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | } |