From 7fa5562190e5f87b909b74f83edf30e51510efa0 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 27 Feb 2020 17:25:43 +0100 Subject: [PATCH] MINOR: fd: Use a separate lock for logs instead of abusing the fd lock. Introduce a new spinlock, log_lock, and use it instead of abusing the FD lock. --- src/fd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fd.c b/src/fd.c index 8eea0f5e9..fb8cc47d6 100644 --- a/src/fd.c +++ b/src/fd.c @@ -364,6 +364,7 @@ void updt_fd_polling(const int fd) } } +__decl_spinlock(log_lock); /* Tries to send parts from followed by parts from * optionally followed by a newline if is non-null, to file descriptor * . The message is sent atomically using writev(). It may be truncated to @@ -421,9 +422,9 @@ ssize_t fd_write_frag_line(int fd, size_t maxlen, const struct ist pfx[], size_t fcntl(fd, F_SETFL, O_NONBLOCK); } - HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock); + HA_SPIN_LOCK(OTHER_LOCK, &log_lock); sent = writev(fd, iovec, vec); - HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock); + HA_SPIN_UNLOCK(OTHER_LOCK, &log_lock); /* sent > 0 if the message was delivered */ return sent;