From 8a0b9de41abc3fc1fa941ddbe68bbd5684ee15b5 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 30 Nov 2011 19:07:04 +0100 Subject: [PATCH] libblockdriver: allow for mixed sync/async replies --- lib/libblockdriver/driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libblockdriver/driver.c b/lib/libblockdriver/driver.c index 2f8aed7a2..d97b58542 100644 --- a/lib/libblockdriver/driver.c +++ b/lib/libblockdriver/driver.c @@ -146,11 +146,15 @@ PUBLIC void blockdriver_reply(message *m_ptr, int ipc_status, int reply) m_ptr->BDEV_STATUS = reply; m_ptr->BDEV_ID = id; - /* If we would block sending the message, send it asynchronously. */ + /* If we would block sending the message, send it asynchronously. The NOREPLY + * flag is set because the caller may also issue a SENDREC (mixing sync and + * async comm), and the asynchronous reply could otherwise end up satisfying + * the SENDREC's receive part, after which our next SENDNB call would fail. + */ if (IPC_STATUS_CALL(ipc_status) == SENDREC) r = sendnb(caller_e, m_ptr); else - r = asynsend(caller_e, m_ptr); + r = asynsend3(caller_e, m_ptr, AMF_NOREPLY); if (r != OK) printf("blockdriver_reply: unable to send reply to %d: %d\n",