From patchwork Sun Jan 15 17:34:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Alcock X-Patchwork-Id: 9517623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A414B600C5 for ; Sun, 15 Jan 2017 17:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC21E27F81 for ; Sun, 15 Jan 2017 17:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3E328339; Sun, 15 Jan 2017 17:34:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1135427F81 for ; Sun, 15 Jan 2017 17:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751249AbdAOReT (ORCPT ); Sun, 15 Jan 2017 12:34:19 -0500 Received: from icebox.esperi.org.uk ([81.187.191.129]:45948 "EHLO mail.esperi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200AbdAOReS (ORCPT ); Sun, 15 Jan 2017 12:34:18 -0500 Received: from spindle (nix@spindle.srvr.nix [192.168.14.15]) by mail.esperi.org.uk (8.15.2/8.15.2) with ESMTP id v0FHY3CE001220; Sun, 15 Jan 2017 17:34:03 GMT From: Nick Alcock To: "Darrick J. Wong" Cc: "Theodore Ts'o" , Linux FS Maling List , daeho.jeong@samsung.com, linux-ext4 Subject: Re: Trouble mounting metadata_csum ext4 filesystems with v4.7.x after c9274d891869880648c4ee9365df3ecc7ba2e285: not enough inode bytes checksummed? References: <87zin42crs.fsf@esperi.org.uk> <20160920055216.GD9309@birch.djwong.org> Emacs: no job too big... no job. Date: Sun, 15 Jan 2017 17:34:03 +0000 In-Reply-To: <20160920055216.GD9309@birch.djwong.org> (Darrick J. Wong's message of "Mon, 19 Sep 2016 22:52:16 -0700") Message-ID: <87wpdww7lg.fsf@esperi.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 X-DCC--Metrics: spindle 1480; Body=5 Fuz1=5 Fuz2=5 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. :) --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;