NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/60746: kernel diagnostic assertion "ino >= LFS_IFILE_INUM" failed: file "../../../../ufs/lfs/lfs_vfsops.c", line 1800
On 9/19/2026 2:15 PM, Shinichi Doyashiki via gnats wrote:
[ 87.8094698] panic: kernel diagnostic assertion "ino >= LFS_IFILE_INUM" failed: file "../../../../ufs/lfs/lfs_vfsops.c", line 1800 ino=0
[ 87.8294701] cpu1: Begin traceback...
[ 87.8294701] vpanic() at netbsd:vpanic+0x171
[ 87.8294701] kern_assert() at netbsd:kern_assert+0x4b
[ 87.8394674] lfs_loadvnode() at netbsd:lfs_loadvnode+0x610
[ 87.8494698] vcache_get() at netbsd:vcache_get+0x1cf
[ 87.8494698] lfs_vget() at netbsd:lfs_vget+0x23
[ 87.8594672] finfo_func_checkempty() at netbsd:finfo_func_checkempty+0x58
The "ino == 0" makes me think that the segment writer overcounted the
number of inodes it put into the inode block. There is some logic for
overwriting an inode that may not be working properly. It is also
possible, of course, that the data that the roll-forward code is trying
to recover is corrupt despite having the right checksum.
Could you try this patch (also attached)?
Index: sys/ufs/lfs/lfs_kclean.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/lfs/lfs_kclean.c,v
retrieving revision 1.4
diff -u -r1.4 lfs_kclean.c
--- sys/ufs/lfs/lfs_kclean.c 5 Jan 2026 05:02:47 -0000 1.4
+++ sys/ufs/lfs/lfs_kclean.c 19 Sep 2026 21:33:32 -0000
@@ -616,9 +616,24 @@
for (i = num; i-- > 0; ) {
dip = DINO_IN_BLOCK(fs, dbp->b_data, i);
ino = lfs_dino_getinumber(fs, dip);
- if (ino == LFS_IFILE_INUM) {
+ KASSERT(ino >= 0);
+ if (ino == 0) {
+ /*
+ * The segment writer overcounted the number
+ * of inodes in this inode block. We can
+ * ignore this inode. (XXX This should not happen.)
+ */
+ continue;
+ } else if (ino == LFS_IFILE_INUM) {
/* Check address against superblock */
true_addr = lfs_sb_getidaddr(fs);
+ } else if (ino >= LFS_MAXINO(fs)) {
+ /*
+ * An inode greater than we have must be from a
+ * previous allocation that was not rolled forward.
+ * For our purposes, it does not exist.
+ */
+ continue;
} else {
/* Not ifile. Check address against ifile. */
LFS_IENTRY(ifp, fs, ino, ibp);
@@ -655,6 +670,12 @@
/* Get the inode and check its version. */
ino = lfs_fi_getino(fs, fip);
gen = lfs_fi_getversion(fs, fip);
+
+ KASSERT(ino >= LFS_IFILE_INUM);
+ /* We can safely ignore this; see comment in ino_func_checkempty. */
+ if (ino >= LFS_MAXINO(fs))
+ return 0;
+
error = VFS_VGET(fs->lfs_ivnode->v_mount, ino,
LK_EXCLUSIVE|LK_NOWAIT, &vp);
/*
Thanks,
--
Konrad Schroder
perseant%hhhh.org@localhost
Index: sys/ufs/lfs/lfs_kclean.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/lfs/lfs_kclean.c,v
retrieving revision 1.4
diff -u -r1.4 lfs_kclean.c
--- sys/ufs/lfs/lfs_kclean.c 5 Jan 2026 05:02:47 -0000 1.4
+++ sys/ufs/lfs/lfs_kclean.c 19 Sep 2026 21:33:32 -0000
@@ -616,9 +616,24 @@
for (i = num; i-- > 0; ) {
dip = DINO_IN_BLOCK(fs, dbp->b_data, i);
ino = lfs_dino_getinumber(fs, dip);
- if (ino == LFS_IFILE_INUM) {
+ KASSERT(ino >= 0);
+ if (ino == 0) {
+ /*
+ * The segment writer overcounted the number
+ * of inodes in this inode block. We can
+ * ignore this inode. (XXX This should not happen.)
+ */
+ continue;
+ } else if (ino == LFS_IFILE_INUM) {
/* Check address against superblock */
true_addr = lfs_sb_getidaddr(fs);
+ } else if (ino >= LFS_MAXINO(fs)) {
+ /*
+ * An inode greater than we have must be from a
+ * previous allocation that was not rolled forward.
+ * For our purposes, it does not exist.
+ */
+ continue;
} else {
/* Not ifile. Check address against ifile. */
LFS_IENTRY(ifp, fs, ino, ibp);
@@ -655,6 +670,12 @@
/* Get the inode and check its version. */
ino = lfs_fi_getino(fs, fip);
gen = lfs_fi_getversion(fs, fip);
+
+ KASSERT(ino >= LFS_IFILE_INUM);
+ /* We can safely ignore this; see comment in ino_func_checkempty. */
+ if (ino >= LFS_MAXINO(fs))
+ return 0;
+
error = VFS_VGET(fs->lfs_ivnode->v_mount, ino, LK_EXCLUSIVE|LK_NOWAIT, &vp);
/*
Home |
Main Index |
Thread Index |
Old Index