HomeFreeBSD

fix zfs_getpages crash when called from sendfile, followup to r329363

Description

fix zfs_getpages crash when called from sendfile, followup to r329363

It turns out that sendfile_swapin() has an optimization where it may
insert pointers to bogus_page into the page array that it passes to
VOP_GETPAGES. That happens to work with buffer cache, because it
extensively uses bogus_page internally, so it has the necessary checks.
However, ZFS did not expect bogus_page as VOP_GETPAGES(9) does not
document such a (ab)use of bogus_page.

So, this commit adds checks and handling of bogus_page.

I expect that use of bogus_page with VOP_GETPAGES will get documented
sooner rather than later.

Reported by: Andrew Reilly <areilly@bigpond.net.au>, delphij
Tested by: Andrew Reilly <areilly@bigpond.net.au>
Requested by: many
MFC after: 1 week

Details

Provenance
avgAuthored on
Parents
rS334202: MFC r333392-r333393, r333427
Branches
Unknown
Tags
Unknown