* [PATCH] btrfs: fix page leaks after failure to lock page for delalloc
@ 2020-07-20 1:42 robbieko
2020-07-20 6:36 ` Nikolay Borisov
2020-07-20 15:34 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: robbieko @ 2020-07-20 1:42 UTC (permalink / raw)
To: linux-btrfs; +Cc: Robbie Ko
From: Robbie Ko <robbieko@synology.com>
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 <robbieko@synology.com>
---
fs/btrfs/extent_io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 68c96057ad2d..22fc47f9c900 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: fix page leaks after failure to lock page for delalloc
2020-07-20 1:42 [PATCH] btrfs: fix page leaks after failure to lock page for delalloc robbieko
@ 2020-07-20 6:36 ` Nikolay Borisov
2020-07-20 15:34 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2020-07-20 6:36 UTC (permalink / raw)
To: robbieko, linux-btrfs
On 20.07.20 г. 4:42 ч., robbieko wrote:
> From: Robbie Ko <robbieko@synology.com>
>
> 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 <robbieko@synology.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent_io.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 68c96057ad2d..22fc47f9c900 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: fix page leaks after failure to lock page for delalloc
2020-07-20 1:42 [PATCH] btrfs: fix page leaks after failure to lock page for delalloc robbieko
2020-07-20 6:36 ` Nikolay Borisov
@ 2020-07-20 15:34 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-07-20 15:34 UTC (permalink / raw)
To: robbieko; +Cc: linux-btrfs
On Mon, Jul 20, 2020 at 09:42:09AM +0800, robbieko wrote:
> From: Robbie Ko <robbieko@synology.com>
>
> 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 <robbieko@synology.com>
Nice catch, added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-20 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 1:42 [PATCH] btrfs: fix page leaks after failure to lock page for delalloc robbieko
2020-07-20 6:36 ` Nikolay Borisov
2020-07-20 15:34 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.