NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60621 (panic: ufs_inactive: dirty filesystem?)



> Date: Sun, 15 Nov 2026 14:32:10 +0000
> From: "J. Hannken-Illjes" <hannken%netbsd.org@localhost>
> 
> With this simple recipe I always get the panic "transaction too big...":
> 
>   dd if=/dev/zero of=file0 bs=1m count=45k
>   /usr/sbin/fssconfig -c -v fss0 / /
>   rm file0

Thanks!  Tried simulating this with /usr/tests/fs/ffs/t_snapshot_log
by cranking down the log size after newfs with tunefs so that we can
reproduce it by rm'ing a smaller file (say 1 MiB instead of 45 GiB).
But it didn't go so well.  With `tunefs -l 69632' (68*1024), the test
still passes, but with `tunefs -l 69631' (67*1024 + 1023), it crashes
with:

panic: kernel diagnostic assertion "delta != size || newoff == oldoff" failed: file "/home/riastradh/netbsd/current/src/sys/rump/librump/rumpvfs/../../../kern/vfs_wapbl.c", line 1460 size=64512, delta=64512 off=1024 newoff=65536 oldoff=0

Which is this assertion (converted locally into KASSERTMSG):

	KASSERTMSG(delta != size || newoff == oldoff,
	    "size=%zu, delta=%zu off=%zu newoff=%zu oldoff=%lld",
	    size, delta, off, newoff, (long long)oldoff);

https://nxr.netbsd.org/xref/src/sys/kern/vfs_wapbl.c?r=1.117#1450

> Using a persistent snapshot or no snapshot the "rm" succeeds.

I assume you mean `Using a *non*-persistent snapshot or no snapshot'?

> Unfortunately on next reboot "wapbl_replay" always succeeds and the
> "ufs_inactive" panic doesn't happen.  I remember seeing this panic
> some times with crashes while an unlinked snapshot was open.

Well, a reproducer for the `transaction too big' panic is still worth
having!

Does it help to use dump instead of fssconfig, and rm the file while
the dump is still running?

> I'm quite sure this inode 61 is such an unlinked snapshot.  It was
> registered with "wapbl_register_inode" when its link count became zero
> while it was still open.  On reboot "wapbl_replay" finds it, truncates
> it to size zero and "ufs_inactive" panics.  As this inode now has
> size zero and block count 0xfffffffffffffec0 == -320 it looks like the
> the field i_blocks was too low, missing 320 disk blocks.
> 
> Have to look deeper into wapbl if there should be a guarantee the number
> of allocated blocks and the inode field i_blocks are in sync when a
> transaction gets flushed.

Presumably any

(a) changes to i_blocks, and
(b) block allocations

happen together in a single wapbl transaction delimited by
UFS_WAPBL_BEGIN/END, no?  Perhaps we need to sprinkle some more
UFS_WAPBL_JLOCK_ASSERT around access to these?


I continue to think that we should invent a new type of logical log
entry for deallocating blocks and truncating an inode (or two types)
so that truncate operations require only bounded size at any given
time in the log -- and we can roll back an incomplete write on crash
if the written data haven't hit the disk (PR kern/58553: ffs: garbage
data appended after crash).



Home | Main Index | Thread Index | Old Index