osmith submitted this change.
io_uring: Avoid extra reads if iofd becomes unregistered by user
The user callback (read_cb, segmentation_cb, etc.) may decide to
unregister the iofd instead of closing it. In this scenario, we should
avoid calling the callback further until the iofd is registered again.
This is a backport of master branch commit
32efc324ce0b30280effef4860bb15588ecb1010.
Change-Id: I514412ecfbb82d32cb3d9c2272795ebac42f55e9
---
M src/core/osmo_io_uring.c
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index b8b240f..cfd72fd 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -189,10 +189,10 @@
if (rc > 0)
msgb_put(msg, rc);
- if (!IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
+ if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED))
iofd_handle_recv(iofd, msg, rc, msghdr);
- if (iofd->u.uring.read_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED))
+ if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_FD_REGISTERED) && iofd->u.uring.read_enabled)
iofd_uring_submit_recv(iofd, msghdr->action);
else
iofd->u.uring.read_msghdr = NULL;
To view, visit change 41365. To unsubscribe, or for help writing mail filters, visit settings.