From owner-svn-src-all@freebsd.org Sat Dec 15 18:49:31 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9685F132A7AE; Sat, 15 Dec 2018 18:49:31 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF4C84B36; Sat, 15 Dec 2018 18:49:31 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CAF31BA07; Sat, 15 Dec 2018 18:49:31 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBFInVhw086770; Sat, 15 Dec 2018 18:49:31 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBFInVl0086769; Sat, 15 Dec 2018 18:49:31 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201812151849.wBFInVl0086769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 15 Dec 2018 18:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342134 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 342134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3BF4C84B36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.80 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-0.88)[-0.883,0]; NEURAL_HAM_SHORT(-0.93)[-0.930,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2018 18:49:31 -0000 Author: mckusick Date: Sat Dec 15 18:49:30 2018 New Revision: 342134 URL: https://svnweb.freebsd.org/changeset/base/342134 Log: Ensure that the inode check-hash is not left zeroed out in the case where the check-hash fails. Prior to the fix in -r342133 the inode with the zeroed out check-hash was written back to disk causing further confusion. Reported by: Gary Jennejohn (gj) Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_subr.c Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Sat Dec 15 18:35:46 2018 (r342133) +++ head/sys/ufs/ffs/ffs_subr.c Sat Dec 15 18:49:30 2018 (r342134) @@ -161,7 +161,7 @@ ffs_load_inode(struct buf *bp, struct inode *ip, struc int ffs_verify_dinode_ckhash(struct fs *fs, struct ufs2_dinode *dip) { - uint32_t save_ckhash; + uint32_t ckhash, save_ckhash; /* * Return success if unallocated or we are not doing inode check-hash. @@ -174,10 +174,11 @@ ffs_verify_dinode_ckhash(struct fs *fs, struct ufs2_di */ save_ckhash = dip->di_ckhash; dip->di_ckhash = 0; - if (save_ckhash != calculate_crc32c(~0L, (void *)dip, sizeof(*dip))) - return (EINVAL); + ckhash = calculate_crc32c(~0L, (void *)dip, sizeof(*dip)); dip->di_ckhash = save_ckhash; - return (0); + if (save_ckhash == ckhash) + return (0); + return (EINVAL); } /*