In its current state, if the destination ring is full, sendv()
will requeue the message and return the rc of pending_requeue(),
which will return 0 on success. This prevents the caller from
distinguishing the difference between a successful write and a
message that needs to be resent at a later time.
Instead, capture the -EAGAIN value returned from ringbuf_insert()
and *only* overwrite it if the rc of pending_requeue() is non-zero.
This allows the caller to make intelligent decisions on -EAGAIN and
still be alerted if the pending message fails to requeue.
Signed-off-by: Nicholas Tsirakis <tsirakisn@ainfosec.com>
Reviewed-by: Christopher Clark <christopher.w.clark@gmail.com>
master commit:
480800c76969b38f13b6909eb679b23571417538
master date: 2019-06-11 20:27:28 +0100
message_type, &len);
if ( ret == -EAGAIN )
{
+ int rc;
+
argo_dprintk("argo_ringbuf_sendv failed, EAGAIN\n");
/* requeue to issue a notification when space is there */
- ret = pending_requeue(dst_d, ring_info, src_id.domain_id, len);
+ rc = pending_requeue(dst_d, ring_info, src_id.domain_id, len);
+ if ( rc )
+ ret = rc;
}
spin_unlock(&ring_info->L3_lock);