CVE-2026-139508: ocfs2: defer suballocator block group reclaim to workqueue
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: defer suballocator block group reclaim to workqueue
When the last bit in a suballocator block group is freed, ocfs2freesuballocbits() reclaims the group back to the global bitmap. The reclaim takes inodelock() on the global bitmap inode while running inside the freeing transaction, adding a lock dependency of
jtransbarrier -> global bitmap inode irwsem
This forms a circular dependency with paths such as ocfs2shutdownlocalalloc(), which take the global bitmap inode lock before starting a transaction:
Task1 (dealloc): ocfs2rundeallocs ocfs2freecachedblocks ocfs2starttrans downread(jtransbarrier) ocfs2freesuballocbits ocfs2reclaimsuballoctomain inodelock(mainbminode) <- wait on Task2
Task2 (dismount): ocfs2shutdownlocalalloc inodelock(mainbminode) ocfs2starttrans downread(jtransbarrier) <- wait on Task3
Task3 (ocfs2cmt): ocfs2commitcache downwrite(jtransbarrier) <- wait on Task1's handle jbd2journalflush
Task1 waits for Task2's inodelock(), Task2 waits for the jtransbarrier downwrite() held by ocfs2cmt, and ocfs2cmt waits for Task1's running transaction to commit - a real deadlock, observed with aio-stress direct IO writes racing dismount.
Fix it by deferring the reclaim to the per-superblock ocfs2wq workqueue, so the freeing transaction no longer takes the global bitmap inode lock. The worker re-checks under the suballocator locks that the block group is still fully freed (it may have been allocated from again in the meantime), takes the global bitmap inode locks before starting its own transaction, and performs the same suballocator cleanup and space return. The inode lock order (suballocator inode -> global bitmap inode) is consistent with the existing "inode lock before transaction" order, breaking the cycle.
Reclaim work can still be queued late in dismount, e.g. when the truncate log is flushed or orphan dir recovery frees inode bits, so both ocfs2dismountvolume() and the mount error path flush ocfs2wq right before the system inodes are released, while the journal is still alive, to make sure no reclaim work is left running. The worker also bails out if the journal is already gone.
Tested with the ocfs2 testsuite (including aio-stress direct IO) and umount/mount cycles on a CONFIGPROVELOCKING kernel: the circular locking dependency is gone and freed block groups are still returned to the global bitmap.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Defer ocfs2 suballocator block-group reclaim to the per-superblock ocfs2_wq workqueue, so reclaim takes the global bitmap inode lock before starting its own transaction.
Event History
Frequently Asked Questions
Are affected or fixed Linux kernel versions identified?
No kernel version range or fixed release is provided. The record identifies two stable-tree changes by commit ID: 18098fed5b27427568087dc17a88d3295492bfb7 and b4cc0016f8ead77c823f2d55f4e0a0e61dd924b3.
Does the available information establish an attacker access requirement or remote exploit path?
No. The supplied information describes a kernel locking deadlock involving OCFS2 allocation reclamation, dismount activity, and transaction-barrier processing, but does not specify an attacker model, required privileges, or a remote attack vector.