From 46f02c4282ff76b66579c83be53ef441ea522536 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 12 Nov 2024 08:29:23 +0200 Subject: [PATCH] SU+J: all writes to SU journal must be exempt from runningbufspace throttling regardless whether they come from the system thread or initiated from a normal thread helping the system. If we block waiting for other writes, that writes might not finish because our journal updates block that. Set TDP_NORUNNINGBUF around softdep_process_journal(). Note: Another solution might be to use bwrite() instead of bawrite() if the current thread is subject to the runningbufspace limit. The exempt approach is used to be same as the bufdaemon. PR: 282449 Noted and reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/ufs/ffs/ffs_softdep.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 97f50867b012..98ad4269b5f2 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3630,6 +3630,7 @@ softdep_process_journal(struct mount *mp, int cnt; int off; int devbsize; + int savef; ump = VFSTOUFS(mp); if (ump->um_softdep == NULL || ump->um_softdep->sd_jblocks == NULL) @@ -3641,6 +3642,8 @@ softdep_process_journal(struct mount *mp, fs = ump->um_fs; jblocks = ump->softdep_jblocks; devbsize = ump->um_devvp->v_bufobj.bo_bsize; + savef = curthread_pflags_set(TDP_NORUNNINGBUF); + /* * We write anywhere between a disk block and fs block. The upper * bound is picked to prevent buffer cache fragmentation and limit @@ -3859,12 +3862,15 @@ softdep_process_journal(struct mount *mp, */ if (flags == 0 && jblocks->jb_suspended) { if (journal_unsuspend(ump)) - return; + goto out; FREE_LOCK(ump); VFS_SYNC(mp, MNT_NOWAIT); ffs_sbupdate(ump, MNT_WAIT, 0); ACQUIRE_LOCK(ump); } + +out: + curthread_pflags_restore(savef); } /*