Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2018 22:15:46 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328566 - head/sys/fs/ext2fs
Message-ID:  <201801292215.w0TMFkjB019836@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Mon Jan 29 22:15:46 2018
New Revision: 328566
URL: https://svnweb.freebsd.org/changeset/base/328566

Log:
  Fix mistake in case of zeroed inode check.
  
  Reported by:	pho
  MFC after:	6 months

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_inode_cnv.c	Mon Jan 29 22:03:01 2018	(r328565)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c	Mon Jan 29 22:15:46 2018	(r328566)
@@ -90,8 +90,10 @@ ext2_print_inode(struct inode *in)
 int
 ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
 {
+	struct m_ext2fs *fs;
 	const static struct ext2fs_dinode ei_zero;
 
+	fs = ip->i_e2fs;
 	ip->i_nlink = ei->e2di_nlink;
 	/*
 	 * Godmar thinks - if the link count is zero, then the inode is
@@ -135,7 +137,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
 
 	memcpy(ip->i_data, ei->e2di_blocks, sizeof(ei->e2di_blocks));
 
-	if (memcmp(ei, &ei_zero, sizeof(struct ext2fs_dinode)))
+	if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM) &&
+	    memcmp(ei, &ei_zero, EXT2_INODE_SIZE(fs)))
 		return (ext2_ei_csum_verify(ip, ei));
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801292215.w0TMFkjB019836>