diff options
author | Amitay Isaacs <amitay@gmail.com> | 2017-09-29 14:23:24 +1000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2017-10-25 08:43:04 +0200 |
commit | 61dcee4aa80d5c90931cf0ee7a8a9e9f16cf1372 (patch) | |
tree | e4744ef8087258399392e48b3b82466f34975e4b | |
parent | 433132e062b8da3837a740f20b6061d2000995ce (diff) | |
download | samba-61dcee4aa80d5c90931cf0ee7a8a9e9f16cf1372.tar.gz |
ctdb-common: Do not queue a packet if queue does not have valid fd
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13056
The only time a ctdb_queue is created without valid fd is when CTDB
is trying to establish connections with other nodes in the cluster.
All the other uses always create a ctdb_queue with valid fd.
This avoids queueing up packets for dead nodes or nodes that are not
running in the cluster and stops consuming memory.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
(cherry picked from commit ddd97553f0a8bfaada178ec4a7460d76fa21f079)
-rw-r--r-- | ctdb/common/ctdb_io.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ctdb/common/ctdb_io.c b/ctdb/common/ctdb_io.c index 152d535f0e5..3e732e8527d 100644 --- a/ctdb/common/ctdb_io.c +++ b/ctdb/common/ctdb_io.c @@ -300,6 +300,11 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length) struct ctdb_queue_pkt *pkt; uint32_t length2, full_length; + /* If the queue does not have valid fd, no point queueing a packet */ + if (queue->fd == -1) { + return 0; + } + if (queue->alignment) { /* enforce the length and alignment rules from the tcp packet allocator */ length2 = (length+(queue->alignment-1)) & ~(queue->alignment-1); |