From: Chao Yu <chao2.yu@samsung.com>
To: 'Gu Zheng' <guz.fnst@cn.fujitsu.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: avoid to use a NULL point in destroy_segment_manager
Date: Wed, 06 Nov 2013 13:10:58 +0800 [thread overview]
Message-ID: <000101cedaae$bb7ed820$327c8860$@samsung.com> (raw)
In-Reply-To: <5279BA67.4040906@cn.fujitsu.com>
Hi Gu,
> -----Original Message-----
> From: Gu Zheng [mailto:guz.fnst@cn.fujitsu.com]
> Sent: Wednesday, November 06, 2013 11:41 AM
> To: Chao Yu
> Cc: ???; linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net; 谭姝
> Subject: Re: [f2fs-dev] [PATCH] f2fs: avoid to use a NULL point in destroy_segment_manager
>
> On 11/06/2013 09:12 AM, Chao Yu wrote:
>
> > A NULL point should avoid to be used in destroy_segment_manager after allocating memory fail for f2fs_sm_info.
>
> Though without this patch it still can work well, because if it failed
> to allocate f2fs_sm_info, the sit_info, free_info... all were NULL, and
> the destory path(e.g. destroy_dirty_segmap) can deal with them well.
I think it could not work well. Without this patch we may got a segment
fault in DIRTY_I(sbi) at the following code if it failed to allocate
f2fs_sm_info memory(sbi->sm_info). Right?
static void destroy_dirty_segmap(struct f2fs_sb_info *sbi)
{
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
> IMO, this patch is still a good catch.
>
> Regards,
> Gu
>
> >
> > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > ---
> > fs/f2fs/segment.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index 3d4d5fc..ff363e6
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -1744,6 +1744,8 @@ static void destroy_sit_info(struct f2fs_sb_info *sbi)
> > void destroy_segment_manager(struct f2fs_sb_info *sbi)
> > {
> > struct f2fs_sm_info *sm_info = SM_I(sbi);
> > + if (!sm_info)
> > + return;
> > destroy_dirty_segmap(sbi);
> > destroy_curseg(sbi);
> > destroy_free_segmap(sbi);
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2013-11-06 5:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-06 1:12 [f2fs-dev] [PATCH] f2fs: avoid to use a NULL point in destroy_segment_manager Chao Yu
2013-11-06 3:41 ` Gu Zheng
2013-11-06 5:10 ` Chao Yu [this message]
2013-11-06 5:15 ` [f2fs-dev] " Gu Zheng
2013-11-06 5:59 ` Chao Yu
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='000101cedaae$bb7ed820$327c8860$@samsung.com' \
--to=chao2.yu@samsung.com \
--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;
as well as URLs for NNTP newsgroup(s).