Skip to content

[UDFS] Fix async paging IO wait handling without boolean literals#73

Closed
Copilot wants to merge 2 commits into
udf-devfrom
copilot/remove-boolean-usage-in-pr
Closed

[UDFS] Fix async paging IO wait handling without boolean literals#73
Copilot wants to merge 2 commits into
udf-devfrom
copilot/remove-boolean-usage-in-pr

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 22, 2026

Paging IO code paths in read.cpp and write.cpp could incorrectly return STATUS_CANT_WAIT or deadlock when Wait was FALSE on entry for an async paging IO request. The fix mirrors the canonical Windows FS driver pattern of setting IRP_CONTEXT_FLAG_WAIT on the IrpContext and deriving Wait from it, rather than assigning a boolean literal.

Changes

  • read.cpp: Added missing async paging IO guard before _SEH2_TRY — absent entirely before this change, meaning Wait could remain FALSE through the if (!Wait) guard in the non-cached read path.
  • write.cpp: Replaced Wait = TRUE in the existing paging IO guard with SetFlag + BooleanFlagOn, consistent with how Wait is initialized from IrpContext->Flags at function entry.
// Before (write.cpp):
if (!Wait && PagingIo) {
    Wait = TRUE;
    SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
}

// After (both read.cpp and write.cpp):
if (!Wait && PagingIo) {
    SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
    Wait = BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
}

SetFlag is the authoritative mutation; Wait is kept in sync by re-deriving it from the flag, matching the existing initialization pattern at line 125 (read.cpp) and line 79 (write.cpp).

Original prompt

This section details on the original issue you should resolve

<issue_title>[UDFS] Find a way to do what the linked PR does without using a boolean</issue_title>
<issue_description>Find a way to do what the PR at assorted#2 does without using a boolean.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…p and write.cpp

Co-authored-by: Zero3K20 <258969903+Zero3K20@users.noreply.github.com>
Copilot AI changed the title [WIP] Find alternative implementation without boolean usage [UDFS] Fix async paging IO wait handling without boolean literals Feb 22, 2026
Copilot AI requested a review from Zero3K20 February 22, 2026 04:26
@Zero3K20 Zero3K20 closed this Feb 22, 2026
@Zero3K20 Zero3K20 deleted the copilot/remove-boolean-usage-in-pr branch February 22, 2026 18:32
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.

2 participants