mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
vfs_io_uring: retry after a short writes in vfs_io_uring_pwrite_completion()
We need to be prepared for short writes from the kernel depending on the state of the page cache. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14361 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
42e77c4cf2
commit
0f01b10679
@ -637,6 +637,14 @@ static void vfs_io_uring_pwrite_completion(struct vfs_io_uring_request *cur,
|
||||
return;
|
||||
}
|
||||
|
||||
if (cur->cqe.res == 0) {
|
||||
/*
|
||||
* Ensure we can never spin.
|
||||
*/
|
||||
tevent_req_error(cur->req, ENOSPC);
|
||||
return;
|
||||
}
|
||||
|
||||
ok = iov_advance(&iov, &num_iov, cur->cqe.res);
|
||||
if (!ok) {
|
||||
/* This is not expected! */
|
||||
@ -647,8 +655,20 @@ static void vfs_io_uring_pwrite_completion(struct vfs_io_uring_request *cur,
|
||||
return;
|
||||
}
|
||||
|
||||
state->nwritten = state->ur.cqe.res;
|
||||
tevent_req_done(cur->req);
|
||||
/* sys_valid_io_range() already checked the boundaries */
|
||||
state->nwritten += state->ur.cqe.res;
|
||||
if (num_iov == 0) {
|
||||
/* We're done */
|
||||
tevent_req_done(cur->req);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* sys_valid_io_range() already checked the boundaries
|
||||
* now try to write the rest.
|
||||
*/
|
||||
state->offset += state->ur.cqe.res;
|
||||
vfs_io_uring_pwrite_submit(state);
|
||||
}
|
||||
|
||||
static ssize_t vfs_io_uring_pwrite_recv(struct tevent_req *req,
|
||||
|
Loading…
x
Reference in New Issue
Block a user