lkml.org 
[lkml]   [2015]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] f2fs: fix to release inode page in get_new_data_page
Hi Chao,

On Thu, Jul 09, 2015 at 06:20:08PM +0800, Chao Yu wrote:
> get_new_data_page should release inode page when we encounter any
> error in its procedure, but there is one error path didn't cover
> this, fix it.

Nice catch.
But, I think we should fix its caller:

in init_inode_metadata(),
err = make_empty_dir();
if (err)
goto put_error;
---------------
Thanks,

>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> fs/f2fs/data.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 08dfdc6..ea8898b 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -397,8 +397,10 @@ struct page *get_new_data_page(struct inode *inode,
> int err;
> repeat:
> page = grab_cache_page(mapping, index);
> - if (!page)
> + if (!page) {
> + f2fs_put_page(ipage, 1);
> return ERR_PTR(-ENOMEM);
> + }
>
> set_new_dnode(&dn, inode, ipage, NULL, 0);
> err = f2fs_reserve_block(&dn, index);
> --
> 2.4.2


\
 
 \ /
  Last update: 2015-07-11 08:21    [W:0.081 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site