HomeFreeBSD

vfs: fix vlrureclaim ->v_object access

Description

vfs: fix vlrureclaim ->v_object access

The routine was checking for ->v_type == VBAD. Since vgone drops the interlock
early sets this type at the end of the process of dooming a vnode, this opens
a time window where it can clear the pointer while the inerlock-holders is
accessing it.

Another note is that the code was:

	   (vp->v_object != NULL &&
	   vp->v_object->resident_page_count > trigger)

With the compiler being fully allowed to emit another read to get the pointer,
and in fact it did on the kernel used by pho.

Use atomic_load_ptr and remember the result.

Note that this depends on type-safety of vm_object.

Reported by: pho

Details

Provenance
mjgAuthored on
Parents
rS357990: vfs: check early for VCHR in vput_final to short-circuit in the common case
Branches
Unknown
Tags
Unknown