Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jan 2021 08:20:56 GMT
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 1f9ee757d96d - stable/13 - MFC: 8c22cf9b
Message-ID:  <202101300820.10U8KuC6098300@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=1f9ee757d96dfc35e0a2d89ef5fd80f26138a693

commit 1f9ee757d96dfc35e0a2d89ef5fd80f26138a693
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2021-01-26 19:46:38 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2021-01-30 08:23:43 +0000

    MFC: 8c22cf9b
    
    Fix fsck_ffs incorrectly reporting "CANNOT READ BLK: NNNN" errors.
    
    A long-standing bug in Pass 1 of fsck_ffs in which it is reading in
    blocks of inodes to check their block pointers. It failed to round
    up the size of the read to a disk block size. When disks would
    accept 512-byte aligned reads, the bug rarely manifested itself.
    But many recent disks will no longer accept 512-byte aligned reads
    but require 4096-byte aligned reads, so the failure to properly
    round-up read sizes to multiples of 4096 bytes makes the error
    much more likely to occur.
    
    Reported by:  Peter Holm and others
    Tested by:    Peter Holm and Rozhuk Ivan
    MFC after:    3 days
    Sponsored by: Netflix
    
    (cherry picked from commit 8c22cf9b0997566ff6f576cfc9296b29bb055f65)
---
 sbin/fsck_ffs/inode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index 18a015f8187e..60019425c825 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -611,8 +611,9 @@ setinodebuf(int cg, ino_t inosused)
 	    sizeof(struct ufs1_dinode) : sizeof(struct ufs2_dinode));
 	readpercg = inosused / fullcnt;
 	partialcnt = inosused % fullcnt;
-	partialsize = partialcnt * ((sblock.fs_magic == FS_UFS1_MAGIC) ?
-	    sizeof(struct ufs1_dinode) : sizeof(struct ufs2_dinode));
+	partialsize = fragroundup(&sblock,
+	    partialcnt * ((sblock.fs_magic == FS_UFS1_MAGIC) ?
+	    sizeof(struct ufs1_dinode) : sizeof(struct ufs2_dinode)));
 	if (partialcnt != 0) {
 		readpercg++;
 	} else {



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