vn_read_from_obj(): fix handling of doomed vnodes.

There is no reason why vp->v_object cannot be NULL. If it is, it's
fine, handle it by delegating to VOP_READ().

Tested by:	pho
Reviewed by:	markj, mjg
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D27327
This commit is contained in:
kib 2020-11-26 18:13:33 +00:00
parent a342635df5
commit 1cede83674

View File

@ -870,10 +870,10 @@ vn_read_from_obj(struct vnode *vp, struct uio *uio)
ssize_t resid;
int error, i, j;
obj = vp->v_object;
MPASS(uio->uio_resid <= ptoa(io_hold_cnt + 2));
MPASS(obj != NULL);
MPASS(obj->type == OBJT_VNODE);
obj = atomic_load_ptr(&vp->v_object);
if (obj == NULL)
return (EJUSTRETURN);
/*
* Depends on type stability of vm_objects.