[lttng-dev] [PATCH lttng-ust v2 2/2] Use ust_lock during sock_info operations for atomicity against fork
Jonathan Rajotte
jonathan.rajotte-julien at efficios.com
Mon Feb 5 22:58:19 UTC 2018
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
v2: Pertinent locking...
Should the locking be more fine-grained and applied around
ustcomm_close_unix_sock and sock_info on both code path only?
---
liblttng-ust/lttng-ust-comm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c
index 32ba3c1..0cf5ecd 100644
--- a/liblttng-ust/lttng-ust-comm.c
+++ b/liblttng-ust/lttng-ust-comm.c
@@ -1396,6 +1396,10 @@ restart:
prev_connect_failed = 0;
}
+ if (ust_lock()) {
+ goto quit;
+ }
+
if (sock_info->socket != -1) {
/* FD tracker is updated by ustcomm_close_unix_sock() */
ret = ustcomm_close_unix_sock(sock_info->socket);
@@ -1415,9 +1419,6 @@ restart:
sock_info->notify_socket = -1;
}
- if (ust_lock()) {
- goto quit;
- }
/*
* Register. We need to perform both connect and sending
--
2.7.4
More information about the lttng-dev
mailing list