Page MenuHomeFreeBSD

Don't mark pages as valid if reading the contents from disk fails.
ClosedPublic

Authored by chs on Jun 4 2020, 10:06 PM.

Details

Summary

While investigating other sendfile issues with I/O error handling,
I noticed that if an async I/O from sendfile fails, then the sendfile code
would avoid sending the stale to the socket, but the pages which could not
be read were still marked valid and left in memory, and then the stale contents
of these pages can be accessed by any normal method such as read().
vnode_pager_generic_getpages_done() indeed marks the pages valid
without checking for errors, so this patch just skips marking the pages
valid if the I/O failed. Future attempts to access such pages will
notice that they are not marked valid and try to read them from disk again.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

chs requested review of this revision.Jun 4 2020, 10:06 PM
kib added inline comments.
sys/vm/vnode_pager.c
1174 ↗(On Diff #72692)

I believe some lines become too long after one more level of indent there.

This revision is now accepted and ready to land.Jun 4 2020, 10:49 PM