mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Fix occasional rsend test crashes
We have occasional crashes in the rsend tests. Debugging revealed that this is because the send_worker thread is getting EINTR from splice(). This happens when a non-fatal signal is received during the syscall. We should retry the syscall, rather than exiting failure. Tweak the loop to only break if the splice is finished or we receive a non-EINTR error. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ahelenia Ziemiańska <[email protected]> Signed-off-by: Paul Dagnelie <[email protected]> Closes #15273
This commit is contained in:
1 parent
90149552b1
commit
6d9bc3ec9f
1 file changed
+6
-4
@@ -650,10 +650,12 @@ send_worker(void *arg)
|
||||
unsigned int bufsiz = max_pipe_buffer(ctx->from);
|
||||
ssize_t rd;
|
||||
|
||||
while ((rd = splice(ctx->from, NULL, ctx->to, NULL, bufsiz,
|
||||
SPLICE_F_MOVE | SPLICE_F_MORE)) > 0)
|
||||
;
|
||||
|
||||
for (;;) {
|
||||
rd = splice(ctx->from, NULL, ctx->to, NULL, bufsiz,
|
||||
SPLICE_F_MOVE | SPLICE_F_MORE);
|
||||
if ((rd == -1 && errno != EINTR) || rd == 0)
|
||||
break;
|
||||
}
|
||||
int err = (rd == -1) ? errno : 0;
|
||||
close(ctx->from);
|
||||
return ((void *)(uintptr_t)err);
|
||||
|
||||
Reference in new issue
Block a user