All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@esperi.org.uk>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	Linux FS Maling List <linux-fsdevel@vger.kernel.org>,
	daeho.jeong@samsung.com, linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: Trouble mounting metadata_csum ext4 filesystems with v4.7.x after c9274d891869880648c4ee9365df3ecc7ba2e285: not enough inode bytes checksummed?
Date: Sun, 15 Jan 2017 17:34:03 +0000	[thread overview]
Message-ID: <87wpdww7lg.fsf@esperi.org.uk> (raw)
In-Reply-To: <20160920055216.GD9309@birch.djwong.org> (Darrick J. Wong's message of "Mon, 19 Sep 2016 22:52:16 -0700")

On 20 Sep 2016, Darrick J. Wong said:
> I /think/ the fix in this case is to hoist the last ext4_chksum call
> out of the EXT4_FITS_IN_INODE blob:
>
> if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
> 	offset = offsetof(struct ext4_inode, i_checksum_hi);
> 	csum = ext4_chksum(sbi, csum, (__u8 *)raw +
> 			   EXT4_GOOD_OLD_INODE_SIZE,
> 			   offset - EXT4_GOOD_OLD_INODE_SIZE);
> 	if (EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) {
> 		csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum,
> 				   csum_size);
> 		offset += csum_size;
> 	}
> 	csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
> 			   EXT4_INODE_SIZE(inode->i_sb) - offset);
> }
>
> Can you give that a try?

Months too late, I can finally confirm that the patch below fixes it for
me (tested in 4.9.4), and I'm running with metadata csums on everywhere
again. :)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 27e4348..ed79c6e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -71,10 +71,10 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
 			csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum,
 					   csum_size);
 			offset += csum_size;
-			csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
-					   EXT4_INODE_SIZE(inode->i_sb) -
-					   offset);
 		}
+		csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
+				   EXT4_INODE_SIZE(inode->i_sb) -
+				   offset);
 	}
 
 	return csum;


  parent reply	other threads:[~2017-01-15 17:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 14:19 Trouble mounting metadata_csum ext4 filesystems with v4.7.x after c9274d891869880648c4ee9365df3ecc7ba2e285: not enough inode bytes checksummed? Nix
2016-09-20  5:52 ` Darrick J. Wong
2017-01-05 11:09   ` Nick Alcock
2017-01-15 17:34   ` Nick Alcock [this message]
     [not found] ` <CGME20160920055236epcas1p191f8fd252e18f762fa3ad9704f5e77e2@epcas1p1.samsung.com>
2016-09-20 13:35   ` 정대호
2016-09-24 20:20 ` Nix

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=87wpdww7lg.fsf@esperi.org.uk \
    --to=nick.alcock@esperi.org.uk \
    --cc=daeho.jeong@samsung.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.