This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Hurd".

The branch, master has been updated
       via  d80222b97855fc3ffe9f7c1856cfd3740b5788dc (commit)
      from  e2306e286a910c9ce59eec5a83f1a60f3a05e792 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d80222b97855fc3ffe9f7c1856cfd3740b5788dc
Author: Milos Nikic <[email protected]>
Date:   Fri Jun 26 14:33:23 2026 -0700

    ext2fs: Fix journal deadlock during transaction finalization
    
    When a VFS thread finalizes a transaction in 
journal_stop_transaction_locked, it holds the global j_state_lock while 
performing memcpy to hydrate shadow buffers from the live Mach virtual memory 
cache (bptr).
    
    Under heavy memory pressure, this memcpy can trigger a Page Fault. If the 
Mach kernel decides to evict dirty pages to satisfy the fault, the ext2fs pager 
is invoked. The pager then attempts to write blocks to disk, which requires 
acquiring the j_state_lock but that lock is already held by the suspended VFS 
thread, causing a circular deadlock.
    
    Fix:
    Decouple memory hydration (memcpy) from the j_state_lock.
    - While holding the lock, identify blocks needing hydration and stage them 
in a thread-local list using jb_next.
    - Temporarily increment t_updates to protect the transaction from being 
freed.
    - Drop the j_state_lock to perform the memcpy. If a page fault occurs here, 
the pager can now safely acquire the lock to satisfy the I/O.
    - Re-acquire the lock and decrement t_updates to finalize the commit.
    
    This ensures the lock is never held while accessing pageable memory.
    
    Test:
    I have run the scenario in which i can recreate the deadlock multiple
    times with debugging messages on and off, and i don't manage to cause this 
specific
    deadlock scenario any more.

-----------------------------------------------------------------------

Summary of changes:
 ext2fs/journal.c | 87 ++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 62 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
Hurd

Reply via email to