From: Namjae Jeon <linkinjeon@gmail.com>
To: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: fix not to allocate max_nid
Date: Mon, 18 Mar 2013 18:29:03 +0900 [thread overview]
Message-ID: <CAKYAXd92_Lxp9A3QCzwhWdctMz=AMVUwzOEqxcbRppLH5dn+hQ@mail.gmail.com> (raw)
In-Reply-To: <1363586028-8617-1-git-send-email-jaegeuk.kim@samsung.com>
2013/3/18, Jaegeuk Kim <jaegeuk.kim@samsung.com>:
> The build_free_nid should not add free nids over nm_i->max_nid.
> But, there was a hole that invalid free nid was added by the following
> scenario.
>
> Let's suppose nm_i->max_nid = 150 and the last NAT page has 100 ~ 200 nids.
>
> build_free_nids
> - get_current_nat_page loads the last NAT page
> - scan_nat_page can add 100 ~ 200 nids
> -> Bug here!
> So, when scanning an NAT page, we should check each candidate whether it is
> over max_nid or not.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> ---
> fs/f2fs/node.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index c60919f..3fb6dfe 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -1270,6 +1270,8 @@ static int scan_nat_page(struct f2fs_nm_info *nm_i,
> i = start_nid % NAT_ENTRY_PER_BLOCK;
>
> for (; i < NAT_ENTRY_PER_BLOCK; i++, start_nid++) {
> + if (start_nid >= nm_i->max_nid)
> + return fcnt;
Hi Jaegeuk.
How about use "break;" instread of "return fcnt" ?
I think that break is better because there is no extra condition before return.
Thanks.
> blk_addr = le32_to_cpu(nat_blk->entries[i].block_addr);
> BUG_ON(blk_addr == NEW_ADDR);
> if (blk_addr == NULL_ADDR)
> --
> 1.8.1.3.566.gaa39828
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-03-18 9:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 5:53 [PATCH] f2fs: fix not to allocate max_nid Jaegeuk Kim
2013-03-18 9:29 ` Namjae Jeon [this message]
2013-03-18 10:13 ` Jaegeuk Kim
2013-03-18 11:28 ` Namjae Jeon
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='CAKYAXd92_Lxp9A3QCzwhWdctMz=AMVUwzOEqxcbRppLH5dn+hQ@mail.gmail.com' \
--to=linkinjeon@gmail.com \
--cc=jaegeuk.kim@samsung.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).