git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Setting tag sliver-openvswitch-1.10.90-3
[sliver-openvswitch.git]
/
lib
/
worker.c
diff --git
a/lib/worker.c
b/lib/worker.c
index
b6d268d
..
6904fdd
100644
(file)
--- a/
lib/worker.c
+++ b/
lib/worker.c
@@
-37,6
+37,11
@@
VLOG_DEFINE_THIS_MODULE(worker);
VLOG_DEFINE_THIS_MODULE(worker);
+/* ovs_assert() logs the assertion message and logging sometimes goes through a
+ * worker, so using ovs_assert() in this source file could cause recursion. */
+#undef ovs_assert
+#define ovs_assert use_assert_instead_of_ovs_assert_in_this_module
+
/* Header for an RPC request. */
struct worker_request {
size_t request_len; /* Length of the payload in bytes. */
/* Header for an RPC request. */
struct worker_request {
size_t request_len; /* Length of the payload in bytes. */
@@
-96,6
+101,9
@@
worker_start(void)
xset_nonblocking(work_fds[0]);
xset_nonblocking(work_fds[1]);
xset_nonblocking(work_fds[0]);
xset_nonblocking(work_fds[1]);
+ /* Don't let the worker process own the responsibility to delete
+ * the pidfile. Register it again after the fork. */
+ remove_pidfile_from_unlink();
if (!fork_and_clean_up()) {
/* In child (worker) process. */
daemonize_post_detach();
if (!fork_and_clean_up()) {
/* In child (worker) process. */
daemonize_post_detach();
@@
-105,6
+113,7
@@
worker_start(void)
}
/* In parent (main) process. */
}
/* In parent (main) process. */
+ add_pidfile_to_unlink();
close(work_fds[1]);
client_sock = work_fds[0];
rxbuf_init(&client_rx);
close(work_fds[1]);
client_sock = work_fds[0];
rxbuf_init(&client_rx);
@@
-224,7
+233,7
@@
worker_send_iovec(const struct iovec iovs[], size_t n_iovs,
} while (error == EINTR);
if (error) {
worker_broke();
} while (error == EINTR);
if (error) {
worker_broke();
- VLOG_ABORT("poll failed (%s)", strerror(error));
+ VLOG_ABORT("poll failed (%s)",
ovs_
strerror(error));
}
}
}
}
}
}
@@
-255,7
+264,7
@@
worker_request_iovec(const struct iovec iovs[], size_t n_iovs,
error = worker_send_iovec(all_iovs, n_iovs + 1, fds, n_fds);
if (error) {
worker_broke();
error = worker_send_iovec(all_iovs, n_iovs + 1, fds, n_fds);
if (error) {
worker_broke();
- VLOG_ABORT("send failed (%s)", strerror(error));
+ VLOG_ABORT("send failed (%s)",
ovs_
strerror(error));
}
free(all_iovs);
}
free(all_iovs);
@@
-338,9
+347,9
@@
worker_reply_iovec(const struct iovec *iovs, size_t n_iovs,
if (error == EPIPE) {
/* Parent probably died. Continue processing any RPCs still buffered,
* to avoid missing log messages. */
if (error == EPIPE) {
/* Parent probably died. Continue processing any RPCs still buffered,
* to avoid missing log messages. */
- VLOG_INFO("send failed (%s)", strerror(error));
+ VLOG_INFO("send failed (%s)",
ovs_
strerror(error));
} else if (error) {
} else if (error) {
- VLOG_
ABORT("send failed (%s)",
strerror(error));
+ VLOG_
FATAL("send failed (%s)", ovs_
strerror(error));
}
free(all_iovs);
}
free(all_iovs);
@@
-374,7
+383,7
@@
worker_main(int fd)
/* Main process closed the IPC socket. Exit cleanly. */
break;
} else if (error != EAGAIN) {
/* Main process closed the IPC socket. Exit cleanly. */
break;
} else if (error != EAGAIN) {
- VLOG_
ABORT("RPC receive failed (%s)", strerror
(error));
+ VLOG_
FATAL("RPC receive failed (%s)", ovs_retval_to_string
(error));
}
poll_fd_wait(server_sock, POLLIN);
}
poll_fd_wait(server_sock, POLLIN);