[Bug 265209] fsck(8) seems to ignore a read error

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 14 Jul 2022 07:43:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265209

            Bug ID: 265209
           Summary: fsck(8) seems to ignore a read error
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: pho@FreeBSD.org

Created attachment 235249
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=235249&action=edit
Mangled test disk image

root@mercat1:~ # /tmp/repro.sh
gunzip < /tmp/fsck8.sh.diskimage.20220713T091402.gz > /work/diskimage
ls -l /tmp/fsck8.sh.diskimage.20220713T091402.gz /work/diskimage
-rw-r--r--  1 root  wheel    808625 Jul 13 09:14
/tmp/fsck8.sh.diskimage.20220713T091402.gz
-rw-r--r--  1 root  wheel  10485760 Jul 14 09:37 /work/diskimage
md=`mdconfig -t vnode -f /work/diskimage`
fsck_ffs -fy /dev/$md; s=$?
** /dev/md0
** Last Mounted on /mnt11
** Phase 1 - Check Blocks and Sizes

CANNOT READ BLK: 128
CONTINUE? yes

THE FOLLOWING DISK SECTORS COULD NOT BE READ:

CANNOT READ BLK: 5312
CONTINUE? yes

THE FOLLOWING DISK SECTORS COULD NOT BE READ:

CANNOT READ BLK: 10496
CONTINUE? yes

THE FOLLOWING DISK SECTORS COULD NOT BE READ:

CANNOT READ BLK: 15680
CONTINUE? yes

THE FOLLOWING DISK SECTORS COULD NOT BE READ:
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
561 files, 950 used, 1473 free (17 frags, 182 blocks, 0.7% fragmentation)

***** FILE SYSTEM IS CLEAN *****
echo "fsck_ffs exit code is: $s"
fsck_ffs exit code is: 0

dumpfs /dev/$md | head -10
dumpfs: /dev/md0: short read from block device
magic   11954 (UFS1)    time    Wed Jul 13 09:14:26 2022
id      [ 62ce70ba 2277a8bf ]
ncg     4       size    2560    blocks  2423
bsize   32768   shift   15      mask    0xffff8000
fsize   4096    shift   12      mask    0xfffff000
frag    8       shift   3       fsbtodb 3
minfree 8%      optim   time    symlinklen 60
maxbpg  4096    maxcontig 32    contigsumsize 16
nbfree  182     ndir    3       nifree  1485    nffree  17
cpg     1       bpg     81      fpg     648     ipg     512
mount /dev/$md /mnt

sleep 2
touch /mnt/xxx
panic: wrong length 4128 for sectorsize 512
cpuid = 7
time = 1657784277
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe014d900660
vpanic() at vpanic+0x151/frame 0xfffffe014d9006b0
panic() at panic+0x43/frame 0xfffffe014d900710
g_io_request() at g_io_request+0x2e8/frame 0xfffffe014d900740
breadn_flags() at breadn_flags+0x1a4/frame 0xfffffe014d9007b0
ffs_getcg() at ffs_getcg+0xce/frame 0xfffffe014d900820
ffs_nodealloccg() at ffs_nodealloccg+0xa4/frame 0xfffffe014d9008b0
ffs_hashalloc() at ffs_hashalloc+0x79/frame 0xfffffe014d900900
ffs_valloc() at ffs_valloc+0x507/frame 0xfffffe014d9009a0
ufs_makeinode() at ufs_makeinode+0xd9/frame 0xfffffe014d900b00
ufs_create() at ufs_create+0x34/frame 0xfffffe014d900b20
VOP_CREATE_APV() at VOP_CREATE_APV+0x62/frame 0xfffffe014d900b40
vn_open_cred() at vn_open_cred+0x2d6/frame 0xfffffe014d900cb0
kern_openat() at kern_openat+0x29a/frame 0xfffffe014d900e00
amd64_syscall() at amd64_syscall+0x145/frame 0xfffffe014d900f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe014d900f30
--- syscall (499, FreeBSD ELF64, sys_openat), rip = 0x1876ae32dbea, rsp =
0x1876ac312a18, rbp = 0x1876ac312b00 ---
KDB: enter: panic
[ thread pid 2807 tid 100258 ]
Stopped at      kdb_enter+0x32: movq    $0,0x129f443(%rip)
db> x/s version
version:        FreeBSD 14.0-CURRENT #0 main-n256684-efe58855f3ea2-dirty: Wed
Jul 13 17:51:29 CEST 2022\012   
pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012
db>

-- 
You are receiving this mail because:
You are the assignee for the bug.