Page MenuHomeFreeBSD

tmpfs: check residence in data_locked
ClosedPublic

Authored by dougm on Oct 2 2024, 6:32 PM.
Tags
None
Referenced Files
F103158564: D46879.diff
Thu, Nov 21, 5:36 PM
F103100987: D46879.id144156.diff
Thu, Nov 21, 12:11 AM
Unknown Object (File)
Sun, Nov 17, 5:53 AM
Unknown Object (File)
Sun, Nov 17, 4:01 AM
Unknown Object (File)
Fri, Nov 15, 9:35 AM
Unknown Object (File)
Thu, Nov 14, 11:04 AM
Unknown Object (File)
Thu, Nov 14, 10:44 AM
Unknown Object (File)
Thu, Nov 14, 4:50 AM
Subscribers

Details

Summary

tmpfs_seek_data_locked should return the offset of the first page either resident in memory or in swap, but may return an offset to a nonresident page. Check for residence to fix that.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Oct 2 2024, 6:32 PM
dougm created this revision.
sys/fs/tmpfs/tmpfs_vnops.c
2111

If we encounter an invalid page, I believe we still need to consult the swap pager before proceeding to the next pindex.

dougm added a subscriber: alc.

Try to address feedback from @markj and @alc.

This revision is now accepted and ready to land.Oct 4 2024, 4:10 AM
alc added inline comments.
sys/fs/tmpfs/tmpfs_vnops.c
2110–2111

if m->pindex != p, testing vm_page_any_valid(m) needn't happen at all if p_swp == p or m->pindex >= p_swp. Otherwise, we were repeating it on the same page in the first iteration of the below loop.

Avoid checking the same page for validity twice, at the cost of finding the next page when it might turn out not to matter.

This revision now requires review to proceed.Oct 4 2024, 6:58 AM
This revision is now accepted and ready to land.Oct 4 2024, 7:22 AM
This revision was automatically updated to reflect the committed changes.