btrfs: fix page leaks after failure to lock page for delalloc
PATCH 1/1 btrfs: fix page leaks after failure to lock page for delalloc
From: Robbie Ko <[email protected]>
When locking pages for delalloc, we check if it's dirty and mapping still matches, if it does not match, we will return -EAGAIN and release all pages.
Signed-off-by Robbie Ko <[email protected]>
--- fs/btrfs/extent_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/extent_io.c +2 -1
@@ -1999,7 +1999,8 @@ static int __process_pages_contig(struct address_space *mapping,if (!PageDirty (pages[i]) || pages[i]->mapping != mapping) {unlock_page (pages[i]); -put_page (pages[i]); +for (; i < ret; i++) +put_page (pages[i]); err = -EAGAIN ; goto out; }
Signature · 1 line
2.17.1
Quoted 7 lines · robbieko
From: Robbie Ko <[email protected]>
When locking pages for delalloc, we check if it's dirty and mapping still matches, if it does not match, we will return
-EAGAINand release all pages.Signed-off-by Robbie Ko <[email protected]>
Reviewed-by Nikolay Borisov <[email protected]>
Quoted 19 lines
--- fs/btrfs/extent_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/btrfs/extent_io.c +2
-1@@ -1999,7 +1999,8 @@ static int __process_pages_contig(struct address_space *mapping,if (!PageDirty (pages[i]) || pages[i]->mapping != mapping) {unlock_page (pages[i]); -put_page (pages[i]); +for (; i < ret; i++) +put_page (pages[i]); err = -EAGAIN ; goto out; }
Quoted 7 lines · robbieko
From: Robbie Ko <[email protected]>
When locking pages for delalloc, we check if it's dirty and mapping still matches, if it does not match, we will return
-EAGAINand release all pages.Signed-off-by Robbie Ko <[email protected]>
Nice catch, added to misc-next, thanks.