Skip to content

Commit 5909ca1

Browse files
Robbie Kokdave
authored andcommitted
btrfs: fix page leaks after failure to lock page for delalloc
When locking pages for delalloc, we check if it's dirty and mapping still matches. If it does not match, we need to return -EAGAIN and release all pages. Only the current page was put though, iterate over all the remaining pages too. CC: [email protected] # 4.14+ Reviewed-by: Filipe Manana <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: Robbie Ko <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent fa91e4a commit 5909ca1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/extent_io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,8 @@ static int __process_pages_contig(struct address_space *mapping,
19991999
if (!PageDirty(pages[i]) ||
20002000
pages[i]->mapping != mapping) {
20012001
unlock_page(pages[i]);
2002-
put_page(pages[i]);
2002+
for (; i < ret; i++)
2003+
put_page(pages[i]);
20032004
err = -EAGAIN;
20042005
goto out;
20052006
}

0 commit comments

Comments
 (0)