Skip to content

Fix O_DIRECT tail offsets for aligned partial I/O#1107

Open
fallintoplace wants to merge 1 commit into
rapidsai:mainfrom
fallintoplace:fix/odirect-tail-offsets
Open

Fix O_DIRECT tail offsets for aligned partial I/O#1107
fallintoplace wants to merge 1 commit into
rapidsai:mainfrom
fallintoplace:fix/odirect-tail-offsets

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

Fix the aligned O_DIRECT tail read/write path to use the correct absolute file offset for the final partial page.

What changed

  • use file_offset + block_read_size for the aligned tail pread()
  • use file_offset + block_write_size for the aligned tail read-modify-write pread() and final pwrite()
  • add a regression case for a page-aligned nonzero file offset with a non-page-aligned transfer size

Why

The aligned tail path was using block_read_size / block_write_size as an absolute file offset. For nonzero page-aligned offsets, that makes the last partial-page operation read or write the wrong page.

That can corrupt file contents on writes and return incorrect bytes on reads.

Validation

  • reviewed the aligned O_DIRECT read and write control flow in cufile_driver.cpp
  • added a regression case to test_cufile.cpp that exercises the affected path
  • not run locally: this machine does not have the CUDA toolchain or GPU runtime available (nvcc and nvidia-smi are not installed)

@fallintoplace
fallintoplace requested a review from a team as a code owner June 27, 2026 21:00
@copy-pr-bot

copy-pr-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant