在 2025/6/19 12:20, Matthew Wilcox 写道:
On Fri, Jun 13, 2025 at 08:07:00PM +0100, Matthew Wilcox (Oracle) wrote:
@@ -201,17 +200,16 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
* |--- search ---|
*/
test_start = SZ_64M;
- locked_page = find_lock_page(inode->i_mapping,
+ locked_folio = filemap_lock_folio(inode->i_mapping,
test_start >> PAGE_SHIFT);
- if (!locked_page) {
- test_err("couldn't find the locked page");
+ if (!locked_folio) {
+ test_err("couldn't find the locked folio");
goto out_bits;
}
btrfs_set_extent_bit(tmp, sectorsize, max_bytes - 1, EXTENT_DELALLOC, NULL);
start = test_start;
end = start + PAGE_SIZE - 1;
- found = find_lock_delalloc_range(inode, page_folio(locked_page), &start,
- &end);
+ found = find_lock_delalloc_range(inode, locked_folio, &start, &end);
if (!found) {
test_err("couldn't find delalloc in our range");
goto out_bits;
Hm. How much do you test the failure paths here? It seems to me that
the 'locked_folio' is still locked at this point ...
Yep, you're right, the error paths here should have the folio unlocked
(all the error handling after fielmap_lock_folio()).
It's just very rare to have a commit that won't pass selftest pushed to
upstream.
Mind to fix it in another patch or you wish us to handle it before your
series?
Thanks,
Qu
@@ -328,8 +323,8 @@ static int test_find_delalloc(u32 sectorsize, u32 nodesize)
dump_extent_io_tree(tmp);
btrfs_clear_extent_bits(tmp, 0, total_dirty - 1, (unsigned)-1);
out:
- if (locked_page)
- put_page(locked_page);
+ if (locked_folio)
+ folio_put(locked_folio);
And here we put it without unlocking it, which should cause the page
allocator to squawk at you.