linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsck.f2fs: check nat_entry->ino for all nodes
@ 2016-02-22 17:01 Sheng Yong
  2016-02-22 17:42 ` Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Sheng Yong @ 2016-02-22 17:01 UTC (permalink / raw)
  To: jaegeuk, chao2.yu, linux-f2fs-devel

Commit 843f5b9388c4652a ("fsck.f2fs: check ino of an inode") checks
nat_entry->ino for inode. However, the checking is irrelevant to node
type, and if ino of other kinds of nodes gets corrupted, fsck.f2fs
cannot detect it. This patch fixes the commit.

Fixes: 843f5b9388c4652a ("fsck.f2fs: check ino of an inode")
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
This is against dev branch.
---
 fsck/fsck.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fsck/fsck.c b/fsck/fsck.c
index 6451595..2d07629 100644
--- a/fsck/fsck.c
+++ b/fsck/fsck.c
@@ -383,8 +383,8 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,
 				le32_to_cpu(node_blk->footer.ino));
 		return -EINVAL;
 	}
-	if (ntype == TYPE_INODE && ni->ino != node_blk->footer.ino) {
-		ASSERT_MSG("nid[0x%x] TYPE_INODE nat_entry->ino[0x%x] footer.ino[0x%x]",
+	if (ni->ino != node_blk->footer.ino) {
+		ASSERT_MSG("nid[0x%x] nat_entry->ino[0x%x] footer.ino[0x%x]",
 				nid, ni->ino, le32_to_cpu(node_blk->footer.ino));
 		return -EINVAL;
 	}
-- 
2.7.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fsck.f2fs: check nat_entry->ino for all nodes
  2016-02-22 17:01 [PATCH] fsck.f2fs: check nat_entry->ino for all nodes Sheng Yong
@ 2016-02-22 17:42 ` Jaegeuk Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2016-02-22 17:42 UTC (permalink / raw)
  To: Sheng Yong; +Cc: linux-f2fs-devel

Hi Sheng,

On Mon, Feb 22, 2016 at 05:01:15PM +0000, Sheng Yong wrote:
> Commit 843f5b9388c4652a ("fsck.f2fs: check ino of an inode") checks
> nat_entry->ino for inode. However, the checking is irrelevant to node
> type, and if ino of other kinds of nodes gets corrupted, fsck.f2fs
> cannot detect it. This patch fixes the commit.

It seems that we can add this condition additionally. (not as fixing something)
I'll merge this patch.

Thanks,

> 
> Fixes: 843f5b9388c4652a ("fsck.f2fs: check ino of an inode")
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>
> ---
> This is against dev branch.
> ---
>  fsck/fsck.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index 6451595..2d07629 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -383,8 +383,8 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,
>  				le32_to_cpu(node_blk->footer.ino));
>  		return -EINVAL;
>  	}
> -	if (ntype == TYPE_INODE && ni->ino != node_blk->footer.ino) {
> -		ASSERT_MSG("nid[0x%x] TYPE_INODE nat_entry->ino[0x%x] footer.ino[0x%x]",
> +	if (ni->ino != node_blk->footer.ino) {
> +		ASSERT_MSG("nid[0x%x] nat_entry->ino[0x%x] footer.ino[0x%x]",
>  				nid, ni->ino, le32_to_cpu(node_blk->footer.ino));
>  		return -EINVAL;
>  	}
> -- 
> 2.7.1
> 
> 
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-22 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 17:01 [PATCH] fsck.f2fs: check nat_entry->ino for all nodes Sheng Yong
2016-02-22 17:42 ` Jaegeuk Kim

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).