Date: Sun, 26 Jan 2020 00:40:27 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357130 - head/sys/kern Message-ID: <202001260040.00Q0eR2s099787@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sun Jan 26 00:40:27 2020 New Revision: 357130 URL: https://svnweb.freebsd.org/changeset/base/357130 Log: vfs: fix freevnodes count update race against preemption vdbatch_process leaves the critical section too early, openign a time window where another thread can get scheduled and modify vd->freevnodes. Once it the preempted thread gets back it overrides the value with 0. Just move critical_exit to the end of the function. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sun Jan 26 00:38:06 2020 (r357129) +++ head/sys/kern/vfs_subr.c Sun Jan 26 00:40:27 2020 (r357130) @@ -3324,10 +3324,10 @@ vdbatch_process(struct vdbatch *vd) vp->v_dbatchcpu = NOCPU; } mtx_unlock(&vnode_list_mtx); - critical_exit(); vd->freevnodes = 0; bzero(vd->tab, sizeof(vd->tab)); vd->index = 0; + critical_exit(); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001260040.00Q0eR2s099787>