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
This commit is contained in:
Konstantin Belousov 2024-11-12 08:29:23 +02:00
parent d0b41249bf
commit 46f02c4282

View File

@ -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);
}
/*