From: Huang Ying <ying.huang@intel.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Changman Lee <cm224.lee@samsung.com>
Cc: Huang Ying <ying.huang@intel.com>,
huang.ying.caritas@gmail.com, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH] f2fs: Fix recover when nid of non-inode dnode < nid of inode
Date: Mon, 8 Sep 2014 19:38:26 +0800 [thread overview]
Message-ID: <1410176306-1689-1-git-send-email-ying.huang@intel.com> (raw)
For fsync, if the nid of a non-inode dnode < nid of inode and the
inode is not checkpointed. The non-inode dnode may be written before
inode. So in find_fsync_dnodes, f2fs_iget will fail, cause the
recovery fail.
Usually, inode will be allocated before non-inode dnode, so the nid of
inode < nid of non-inode dnode. But it is possible for the reverse.
For example, because of alloc_nid_failed.
This is fixed via ignoring non-inode dnode before inode dnode in
find_fsync_dnodes.
The patch was tested via allocating nid reversely via a debugging
patch, that is, from big number to small number.
Signed-off-by: Huang, Ying <ying.huang@intel.com>
---
fs/f2fs/recovery.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -172,8 +172,8 @@ static int find_fsync_dnodes(struct f2fs
if (IS_INODE(page) && is_dent_dnode(page))
set_inode_flag(F2FS_I(entry->inode),
FI_INC_LINK);
- } else {
- if (IS_INODE(page) && is_dent_dnode(page)) {
+ } else if (IS_INODE(page)) {
+ if (is_dent_dnode(page)) {
err = recover_inode_page(sbi, page);
if (err)
break;
@@ -193,7 +193,8 @@ static int find_fsync_dnodes(struct f2fs
break;
}
list_add_tail(&entry->list, head);
- }
+ } else
+ goto next;
entry->blkaddr = blkaddr;
err = recover_inode(entry->inode, page);
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
WARNING: multiple messages have this Message-ID (diff)
From: Huang Ying <ying.huang@intel.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Changman Lee <cm224.lee@samsung.com>
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Huang Ying <ying.huang@intel.com>,
huang.ying.caritas@gmail.com
Subject: [PATCH] f2fs: Fix recover when nid of non-inode dnode < nid of inode
Date: Mon, 8 Sep 2014 19:38:26 +0800 [thread overview]
Message-ID: <1410176306-1689-1-git-send-email-ying.huang@intel.com> (raw)
For fsync, if the nid of a non-inode dnode < nid of inode and the
inode is not checkpointed. The non-inode dnode may be written before
inode. So in find_fsync_dnodes, f2fs_iget will fail, cause the
recovery fail.
Usually, inode will be allocated before non-inode dnode, so the nid of
inode < nid of non-inode dnode. But it is possible for the reverse.
For example, because of alloc_nid_failed.
This is fixed via ignoring non-inode dnode before inode dnode in
find_fsync_dnodes.
The patch was tested via allocating nid reversely via a debugging
patch, that is, from big number to small number.
Signed-off-by: Huang, Ying <ying.huang@intel.com>
---
fs/f2fs/recovery.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -172,8 +172,8 @@ static int find_fsync_dnodes(struct f2fs
if (IS_INODE(page) && is_dent_dnode(page))
set_inode_flag(F2FS_I(entry->inode),
FI_INC_LINK);
- } else {
- if (IS_INODE(page) && is_dent_dnode(page)) {
+ } else if (IS_INODE(page)) {
+ if (is_dent_dnode(page)) {
err = recover_inode_page(sbi, page);
if (err)
break;
@@ -193,7 +193,8 @@ static int find_fsync_dnodes(struct f2fs
break;
}
list_add_tail(&entry->list, head);
- }
+ } else
+ goto next;
entry->blkaddr = blkaddr;
err = recover_inode(entry->inode, page);
next reply other threads:[~2014-09-08 11:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 11:38 Huang Ying [this message]
2014-09-08 11:38 ` [PATCH] f2fs: Fix recover when nid of non-inode dnode < nid of inode Huang Ying
2014-09-09 5:23 ` Jaegeuk Kim
2014-09-09 5:23 ` Jaegeuk Kim
2014-09-09 5:39 ` Huang Ying
2014-09-09 7:09 ` Jaegeuk Kim
2014-09-09 7:09 ` Jaegeuk Kim
[not found] ` <CAC=cRTMA9AqmHjQqK3=5pAs8yqi25Rzmz8MaZ8=oTDaxHAXU+A@mail.gmail.com>
2014-09-10 7:21 ` Jaegeuk Kim
2014-09-10 7:21 ` Jaegeuk Kim
[not found] ` <CAC=cRTMGJfD_SZ=bE8pi5U6n5W1MF17emLC3VZDbpLSQtbNcKg@mail.gmail.com>
2014-09-11 5:37 ` Jaegeuk Kim
2014-09-11 5:37 ` Jaegeuk Kim
2014-09-11 10:47 ` Chao Yu
2014-09-11 10:47 ` [f2fs-dev] " Chao Yu
2014-09-11 12:31 ` Huang Ying
2014-09-11 12:31 ` [f2fs-dev] " Huang Ying
2014-09-11 12:25 ` Huang Ying
2014-09-11 12:25 ` Huang Ying
2014-09-12 5:13 ` Jaegeuk Kim
2014-09-12 7:34 ` Huang Ying
2014-09-12 7:34 ` Huang Ying
2014-09-13 14:23 ` Huang Ying
2014-09-13 14:23 ` Huang Ying
2014-09-14 7:48 ` Jaegeuk Kim
2014-09-14 7:48 ` Jaegeuk Kim
2014-09-15 5:14 ` Huang Ying
2014-09-15 5:14 ` Huang Ying
2014-09-18 5:47 ` Jaegeuk Kim
2014-09-14 7:38 ` Jaegeuk Kim
2014-09-14 7:38 ` Jaegeuk Kim
2014-09-15 1:32 ` Huang Ying
2014-09-15 1:32 ` Huang Ying
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=1410176306-1689-1-git-send-email-ying.huang@intel.com \
--to=ying.huang@intel.com \
--cc=cm224.lee@samsung.com \
--cc=huang.ying.caritas@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.