linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/3] f2fs: fix missing kmem_cache_free
Date: Fri, 5 Dec 2014 11:34:49 +0800	[thread overview]
Message-ID: <548127D9.4030007@cn.fujitsu.com> (raw)
In-Reply-To: <1417740583-1681-1-git-send-email-jaegeuk@kernel.org>

Hi Jaegeuk, 
On 12/05/2014 08:49 AM, Jaegeuk Kim wrote:

> This patch fixes missing kmem_cache_free when handling errors.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/node.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index b1466cf..c59341d 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -158,7 +158,7 @@ retry:
>  		head->entry_cnt = 0;
>  
>  		if (radix_tree_insert(&nm_i->nat_set_root, set, head)) {
> -			cond_resched();
> +			kmem_cache_free(nat_entry_set_slab, head);

Why not reuse the allocated entry?
This routine is under nat_tree_lock, so the free_old->research->alloc_new
is needless, because no other ones can race with us.

>  			goto retry;

And radix_tree_insert can only fail -ENOMEM here, IMO, the in-time retry step
makes very little sense here. How about retaining the "cond_resched()" and retry
insert later?

If I misread something, please correct me.:)

Thanks,
Gu

>  		}
>  	}

  parent reply	other threads:[~2014-12-05  3:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05  0:49 [PATCH 1/3] f2fs: fix missing kmem_cache_free Jaegeuk Kim
2014-12-05  0:49 ` [PATCH 2/3] f2fs: use rw_semaphore for nat entry lock Jaegeuk Kim
2014-12-05  0:49 ` [PATCH 3/3] f2fs: call radix_tree_preload before radix_tree_insert Jaegeuk Kim
2014-12-05  3:34 ` Gu Zheng [this message]
2014-12-05 18:18   ` [PATCH 1/3] f2fs: fix missing kmem_cache_free Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=548127D9.4030007@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).