Skip to content

Commit eb62af0

Browse files
markjdbixhamza
authored andcommitted
Fix a potential page leak in mappedread_sf()
mappedread_sf() may allocate pages; if it fails to populate a page can't free it, it needs to ensure that it's placed into a page queue, otherwise it can't be reclaimed until the vnode is destroyed. I think this is quite unlikely to happen in practice, it was noticed by code inspection. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes openzfs#16643
1 parent b1d18d3 commit eb62af0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

module/os/freebsd/zfs/zfs_vnops_os.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,10 @@ mappedread_sf(znode_t *zp, int nbytes, zfs_uio_t *uio)
452452
if (!vm_page_wired(pp) && pp->valid == 0 &&
453453
vm_page_busy_tryupgrade(pp))
454454
vm_page_free(pp);
455-
else
455+
else {
456+
vm_page_deactivate_noreuse(pp);
456457
vm_page_sunbusy(pp);
458+
}
457459
zfs_vmobject_wunlock(obj);
458460
}
459461
} else {

0 commit comments

Comments
 (0)