mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 07:11:20 +02:00
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.
This commit is contained in:
parent
079f808741
commit
7fa5562190
5
src/fd.c
5
src/fd.c
@ -364,6 +364,7 @@ void updt_fd_polling(const int fd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__decl_spinlock(log_lock);
|
||||||
/* Tries to send <npfx> parts from <prefix> followed by <nmsg> parts from <msg>
|
/* Tries to send <npfx> parts from <prefix> followed by <nmsg> parts from <msg>
|
||||||
* optionally followed by a newline if <nl> is non-null, to file descriptor
|
* optionally followed by a newline if <nl> is non-null, to file descriptor
|
||||||
* <fd>. The message is sent atomically using writev(). It may be truncated to
|
* <fd>. 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);
|
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);
|
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 */
|
/* sent > 0 if the message was delivered */
|
||||||
return sent;
|
return sent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user