From nobody Mon Aug 29 06:09:55 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MGKm41MP9z4bN5W; Mon, 29 Aug 2022 06:09:56 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MGKm40khcz3Vqk; Mon, 29 Aug 2022 06:09:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661753396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZJiEVX7Ovb1qp5qYWt8ClYonQhFNYdGyKVFVFJ9w0M=; b=irP1hI5kkHX8mN6CaFcKz7MUomNrs8DQUSTkrnI1Cv95bh2bi/yhODkZl7QWJldhk3+oEx sfZo5R4U/iUIWRz+SLElTefxhuYRHpwZHCRvY0WE53wrED61vyRrlWgliy/t9ebHRMmfj/ pGZMKtzthh7XOxWm1ZVlsskoEMnOwOWisyANneCZV3Q9olmX6sND3Q/XcsvSbqkEzp5RRK rvgs96efURq5iRFYU4EdwooTWX+oiG2lg7g/4Y0MZzb4LOc98QFTsienriIBjQrVN3wDVJ 0cdzEWkSBosgvcXuJtPaNPmPiZtyDcjPkACIqcOts/l3d2Erh4JpeTx53r87CQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MGKm36ZWxzKyr; Mon, 29 Aug 2022 06:09:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27T69tmf092368; Mon, 29 Aug 2022 06:09:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27T69tB0092367; Mon, 29 Aug 2022 06:09:55 GMT (envelope-from git) Date: Mon, 29 Aug 2022 06:09:55 GMT Message-Id: <202208290609.27T69tB0092367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 2e4da012d57e - main - Correct calculation of inode location in getnextino cache. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2e4da012d57edab9d71dc7a67dc706b6a9b7800d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661753396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=eZJiEVX7Ovb1qp5qYWt8ClYonQhFNYdGyKVFVFJ9w0M=; b=hRUeVVTyBJka8BrB7WaE30y4Fs75MKEUT2wqXp+tkSDKhDYEa/2VlE7WKyu/PBRPeV97lb JI+Wg4Bxw0UQd5mhxtVnVcuTiuxouqMHil6sFivH3AirOLnWM7JNDa4zLg/rux2DT3pD5L GOOgnxr6SvPwKdnFEkINJXP2tSF1VebbwYRFOW6aVdCSNVHMzEeLp7XDBYKQkk2ZElwxyi baui44r7R3Q/SVPgTbeUz7L43KwElTLLfyzJEHFmxmUGXwJpv01VEZTiCVLxjjgPlv9bKV gBTX30wD49PpqeVMOdmZHNaFF0RKk+um+mk1WUhRnyfSP0Njy2cRozk4szLjQQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661753396; a=rsa-sha256; cv=none; b=K4JUARU1s41/EyGiNcYu1phgRnfqvnp0+phdpmFcJ1OxsrDlPRE7DGF0qtc9NYC+pLt53H LMNcBInLnWOU47TRyzX/R/WEOaJcnpSYRly8NoLsTjB/oQBDuywt6O1n9X6s/eSXYY3BBT sL4jXe5W1AofMxuxiiEaSwTm95nqwjSGW3OyUbesWoXhVXHgjW9JlKIs50Q4u0fvnSpWha fr59DfKJ3tU2DDJIpgJJrCaK+5gaTGGBjINR/Du+rv2pWdvrepOk51iLNB0sUqoG/+Qvpc BEv7rxAjgnceQotpdhqKjN1xCjwRIIJsiaHu2BmuemU1ZBAYF44SslW7ldc90A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=2e4da012d57edab9d71dc7a67dc706b6a9b7800d commit 2e4da012d57edab9d71dc7a67dc706b6a9b7800d Author: Kirk McKusick AuthorDate: 2022-08-29 06:08:49 +0000 Commit: Kirk McKusick CommitDate: 2022-08-29 06:09:29 +0000 Correct calculation of inode location in getnextino cache. Fix for 345bfec. Reported by: Peter Holm Sponsored by: The FreeBSD Foundation --- sbin/fsck_ffs/fsutil.c | 2 +- sbin/fsck_ffs/inode.c | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 6b4cdc146def..aa1bfb32ab5b 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -465,7 +465,7 @@ flush(int fd, struct bufarea *bp) struct ufs2_dinode *dp = bp->b_un.b_dinode2; int i; - for (i = 0; i < INOPB(&sblock); dp++, i++) { + for (i = 0; i < bp->b_size; dp++, i += sizeof(*dp)) { if (ffs_verify_dinode_ckhash(&sblock, dp) == 0) continue; pwarn("flush: INODE CHECK-HASH FAILED"); diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index ae7124784415..1d65ec667d44 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -425,7 +425,6 @@ void ginode(ino_t inumber, struct inode *ip) { ufs2_daddr_t iblk; - ino_t numinodes; if (inumber < UFS_ROOTINO || inumber > maxino) errx(EEXIT, "bad inode number %ju to ginode", @@ -436,14 +435,12 @@ ginode(ino_t inumber, struct inode *ip) ip->i_bp = &inobuf; inobuf.b_refcnt++; inobuf.b_index = firstinum; - numinodes = lastinum - firstinum; } else if (icachebp != NULL && inumber >= icachebp->b_index && inumber < icachebp->b_index + INOPB(&sblock)) { /* take an additional reference for the returned inode */ icachebp->b_refcnt++; ip->i_bp = icachebp; - numinodes = INOPB(&sblock); } else { iblk = ino_to_fsba(&sblock, inumber); /* release our cache-hold reference on old icachebp */ @@ -460,15 +457,14 @@ ginode(ino_t inumber, struct inode *ip) icachebp->b_refcnt++; icachebp->b_index = rounddown(inumber, INOPB(&sblock)); ip->i_bp = icachebp; - numinodes = INOPB(&sblock); } if (sblock.fs_magic == FS_UFS1_MAGIC) { ip->i_dp = (union dinode *) - &ip->i_bp->b_un.b_dinode1[inumber % numinodes]; + &ip->i_bp->b_un.b_dinode1[inumber - firstinum]; return; } ip->i_dp = (union dinode *) - &ip->i_bp->b_un.b_dinode2[inumber % numinodes]; + &ip->i_bp->b_un.b_dinode2[inumber - firstinum]; if (ffs_verify_dinode_ckhash(&sblock, (struct ufs2_dinode *)ip->i_dp)) { pwarn("INODE CHECK-HASH FAILED"); prtinode(ip);