mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Gu Zheng <guz.fnst@cn.fujitsu.com>
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 10:18:32 -0800	[thread overview]
Message-ID: <20141205181832.GB6641@jaegeuk-mac02> (raw)
In-Reply-To: <548127D9.4030007@cn.fujitsu.com>

Hi Gu,

On Fri, Dec 05, 2014 at 11:34:49AM +0800, Gu Zheng wrote:
> 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.

IMO, this issue is quite different one that you're mentioning.
This patch just fixes a missing kfree.

> 
> >  			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?

I think the following patches related to radix_tree_preload that I submitted
would address that.
But, still it seems that I need to review the retrial paths again.

Thanks,

> 
> If I misread something, please correct me.:)
> 
> Thanks,
> Gu
> 
> >  		}
> >  	}

      reply	other threads:[~2014-12-05 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-05  0:49 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 ` [PATCH 1/3] f2fs: fix missing kmem_cache_free Gu Zheng
2014-12-05 18:18   ` Jaegeuk Kim [this message]

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=20141205181832.GB6641@jaegeuk-mac02 \
    --to=jaegeuk@kernel.org \
    --cc=guz.fnst@cn.fujitsu.com \
    --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

all inboxes | Powered by JetHome®