-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(dd): handle O_DIRECT partial block writes #9016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CodSpeed Performance ReportMerging #9016 will not alter performanceComparing Summary
Footnotes
|
f6b6d58 to
4d0e222
Compare
|
GNU testsuite comparison: |
|
I had a different approach in mind, but your is faster. |
aa80de1 to
dda4422
Compare
Fix dd failures with 'IO Error: Invalid input' when using oflag=direct with partial blocks. The issue occurs because O_DIRECT requires proper alignment for all writes, but the final partial block may not meet these requirements. This fix: - Detects EINVAL errors that might be O_DIRECT alignment issues - Temporarily removes O_DIRECT flag using fcntl(F_SETFL) - Retries the write operation without the direct flag - Restores original flags (safer than GNU approach) - Only activates on Linux/Android platforms where O_DIRECT is supported Matches GNU dd behavior discovered through strace analysis.
dda4422 to
bcba024
Compare
|
GNU testsuite comparison: |
kudos! |
hey, got a fix for that dd oflag=direct "invalid input" error on this branch.
addresses issue #9003 where dd fails with 'IO Error: Invalid input' when using oflag=direct with partial blocks.
also related to issue #6078 about gnu test failures. turns out gnu dd temporarily removes the o_direct flag for blocks, but
we weren't doing that. added a simple helper function that detects the alignment error, removes the flag, retries the write, then puts it.
only affects linux/android where o_direct actually works. studied the codebase history, the original file write code
4621557 hasn't changed since so this builds on established patterns.