You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current copy_file() does not wait for all submitted I/O's to complete before returning to main() which the latter closes the files and calls io_uring_queue_exit(). Any I/Os which are still in progress will be lost. This manifests as the output file having fewer bytes than the input file. This is tested and is repeatable in Ubuntu 20 running in a VM under VMWare Workstation, using liburing2_2.1-2build1_amd64.deb.
One way to fix this is to add the following codes before the return statement at the end of copy_file() to wait for all I/Os to complete before returning:
int num_pending = reads + writes; // # of I/O requests still pending.
for (int i=0; i<num_pending; i++) { // Wait for them to complete or else some may be discarded upon premature io_uring exit.
io_uring_wait_cqe(ring, &cqe);
io_uring_cqe_get_data(cqe);
io_uring_cqe_seen(ring, cqe);
}
Cheers,
Jack
The text was updated successfully, but these errors were encountered:
The current copy_file() does not wait for all submitted I/O's to complete before returning to main() which the latter closes the files and calls io_uring_queue_exit(). Any I/Os which are still in progress will be lost. This manifests as the output file having fewer bytes than the input file. This is tested and is repeatable in Ubuntu 20 running in a VM under VMWare Workstation, using liburing2_2.1-2build1_amd64.deb.
One way to fix this is to add the following codes before the return statement at the end of copy_file() to wait for all I/Os to complete before returning:
Cheers,
Jack
The text was updated successfully, but these errors were encountered: