vm_pager_allocate(): override resulting object type

For dynamically allocated pager type, which inherits the parent's alloc
method, type of the returned object is set to the parent's type
otherwise.

Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37097
This commit is contained in:
Konstantin Belousov 2022-12-04 02:37:28 +02:00
parent ec201dddfb
commit cd086696c2

View File

@ -258,9 +258,14 @@ vm_object_t
vm_pager_allocate(objtype_t type, void *handle, vm_ooffset_t size,
vm_prot_t prot, vm_ooffset_t off, struct ucred *cred)
{
vm_object_t object;
MPASS(type < nitems(pagertab));
return ((*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred));
object = (*pagertab[type]->pgo_alloc)(handle, size, prot, off, cred);
if (object != NULL)
object->type = type;
return (object);
}
/*