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?)
Taylor,
sleeping another night over this problem I propose two possible fixes.
What do you think?
* To prevent the "ufs_inactive: dirty filesystem?" panic the
block allocation and inode update must be grouped into the
same transaction. This diff should fix it -- untested as I'm
unable to reproduce the panic here:
--- sys/ufs/ffs/ffs_snapshot.c Wed Nov 11 15:17:24 2026 +0100
+++ sys/ufs/ffs/ffs_snapshot.c Wed Nov 18 15:39:40 2026 +0100
@@ -1653,6 +1653,7 @@ retry:
}
DIP_ADD(ip, blocks, btodb(size));
ip->i_flag |= IN_CHANGE | IN_UPDATE;
+ UFS_WAPBL_UPDATE(vp, NULL, NULL, 0);
if (ip->i_nlink > 0 && mp->mnt_wapbl)
error = syncsnap(vp);
else
* The "wapbl_flush: current transaction too big to flush" panic
goes back to PR kern/47146 at least. It was fixed with a
reorganization of ffs_truncate() and the change to
wapbl_register_deallocation() to return EAGAIN on resource shortage.
Unfortunately th evaluation of resource shortage looks incomplete as
only "wl_dealloccnt" is checked. Replacing this check with
the "doflush" check already in wapbl_begin() but replacing "/ 2"
with "* 3 / 4" I cannot reproduce this panic anymore. I use 75% instead
of 50% so after wapbl_register_deallocation() returning EAGAIN the
next wapbl_begin() will always flush. This is the diff:
--- sys/kern/vfs_wapbl.c Wed Nov 11 15:17:24 2026 +0100
+++ sys/kern/vfs_wapbl.c Wed Nov 18 15:39:40 2026 +0100
@@ -2193,7 +2193,18 @@ wapbl_register_deallocation(struct wapbl
mutex_enter(&wl->wl_mtx);
- if (__predict_false(wl->wl_dealloccnt >= wl->wl_dealloclim)) {
+ int doflush;
+ unsigned lockcount;
+
+ lockcount = wl->wl_lock_count;
+ doflush = ((wl->wl_bufbytes + (lockcount * MAXPHYS)) >
+ wl->wl_bufbytes_max * 3 / 4) ||
+ ((wl->wl_bufcount + (lockcount * 10)) >
+ wl->wl_bufcount_max * 3 / 4) ||
+ (wapbl_transaction_len(wl) > wl->wl_circ_size * 3 / 4) ||
+ (wl->wl_dealloccnt >= (wl->wl_dealloclim * 3 / 4));
+
+ if (__predict_false(doflush)) {
if (!force) {
error = SET_ERROR(EAGAIN);
goto out;
--
J. Hannken-Illjes - hannken%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index