Add a PDU flag for discard after sending.

Add a flags field to rpc_pdu and add a flag that indicates that the PDU
should be discarded as soon as it has been written to the socket.
We do not put it on the waitpdu queue nor do we wait for a reply.

This will later be used for when we are sending replies back to a client
when operating in a server context.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2016-11-28 21:34:40 -08:00
parent 6f27daf6d4
commit 11f85665fc
2 changed files with 8 additions and 0 deletions

View File

@ -155,6 +155,9 @@ struct rpc_pdu {
zdrproc_t zdr_decode_fn;
caddr_t zdr_decode_buf;
uint32_t zdr_decode_bufsize;
#define PDU_DISCARD_AFTER_SENDING 0x00000001
uint32_t flags;
};
void rpc_reset_queue(struct rpc_queue *q);

View File

@ -210,6 +210,11 @@ static int rpc_write_to_socket(struct rpc_context *rpc)
if (pdu->next == NULL)
rpc->outqueue.tail = NULL;
if (pdu->flags & PDU_DISCARD_AFTER_SENDING) {
rpc_free_pdu(rpc, pdu);
return 0;
}
hash = rpc_hash_xid(pdu->xid);
rpc_enqueue(&rpc->waitpdu[hash], pdu);
}