Re: [PATCH] bcachefs: Fix deadlocks between fallocate and readahead
Deepanshu Kartikey <[email protected]> Mon, 29 Sep 2025 13:26:43 +0530
| Newsgroups | org.kernel.vger.linux-bcachefs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
I found that bchfs_fallocate() only evicts pagecache when FALLOC_FL_ZERO_RANGE is set:
if (mode & FALLOC_FL_ZERO_RANGE) {
ret = bch2_truncate_folios(inode, offset, end);
truncate_pagecache_range(&inode->v, offset, end - 1);
}
So basic fallocate (mode=0 or just KEEP_SIZE) doesn't evict pages and shouldn't need pagecache_block_get().
Should the fix be to only acquire pagecache_block_get() for modes that actually evict (ZERO_RANGE, PUNCH_HOLE, INSERT/COLLAPSE)?