From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 2/2] fsck.f2fs: fix losing journal entries
Date: Mon, 21 Dec 2015 09:44:52 -0800 [thread overview]
Message-ID: <1450719892-10731-2-git-send-email-jaegeuk@kernel.org> (raw)
In-Reply-To: <1450719892-10731-1-git-send-email-jaegeuk@kernel.org>
If fsck.f2fs reports a bug, move_curseg_info tries to change the current
segment info.
When it changes the new summary block, it overwrites the existing journal
entries.
This patch fixes it not to overwrite journal entry space.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fsck/mount.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index d2f1432..fe68f37 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1438,6 +1438,7 @@ void move_curseg_info(struct f2fs_sb_info *sbi, u64 from)
/* update summary blocks having nullified journal entries */
for (i = 0; i < NO_CHECK_TYPE; i++) {
struct curseg_info *curseg = CURSEG_I(sbi, i);
+ struct f2fs_summary_block buf;
u32 old_segno;
u64 ssa_blk, to;
@@ -1457,9 +1458,11 @@ void move_curseg_info(struct f2fs_sb_info *sbi, u64 from)
/* update new segno */
ssa_blk = GET_SUM_BLKADDR(sbi, curseg->segno);
- ret = dev_read_block(curseg->sum_blk, ssa_blk);
+ ret = dev_read_block(&buf, ssa_blk);
ASSERT(ret >= 0);
+ memcpy(curseg->sum_blk, &buf, SUM_ENTRIES_SIZE);
+
/* update se->types */
reset_curseg(sbi, i);
--
2.5.4 (Apple Git-61)
------------------------------------------------------------------------------
prev parent reply other threads:[~2015-12-21 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-21 17:44 [PATCH 1/2] defrag.f2fs: fix missing SSA updates Jaegeuk Kim
2015-12-21 17:44 ` 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=1450719892-10731-2-git-send-email-jaegeuk@kernel.org \
--to=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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).