[PATCH] btrfs: fix missing folio_unlock in read_merkle_tree_page error path
Hongling Zeng <[email protected]>
| Newsgroups | org.kernel.vger.linux-btrfs,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
filemap_add_folio() adds the folio to the page cache and leaves it locked.
If read_key_bytes() fails, the error path only calls folio_put() without
first unlocking the folio, leaving it permanently locked in the page cache.
This causes subsequent attempts to lock this folio to hang.
Fix by adding folio_unlock() before folio_put() in the error handling path.
Fixes: 06ed09351b67 ("btrfs: convert btrfs_read_merkle_tree_page() to use a folio")
Cc: [email protected]
Assisted-by: Codex:gpt-5.5
Signed-off-by: Hongling Zeng <[email protected]>
---
fs/btrfs/verity.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/verity.c b/fs/btrfs/verity.c
index 983365a73541..4431656140f8 100644
--- a/fs/btrfs/verity.c
+++ b/fs/btrfs/verity.c
@@ -753,6 +753,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,
ret = read_key_bytes(BTRFS_I(inode), BTRFS_VERITY_MERKLE_ITEM_KEY, off,
folio_address(folio), PAGE_SIZE, folio);
if (ret < 0) {
+ folio_unlock(folio);
folio_put(folio);
return ERR_PTR(ret);
}
--
2.25.1