Page MenuHomeFreeBSD

msdosfs deextend: validate pages of the partial buffer
ClosedPublic

Authored by kib on Feb 12 2023, 6:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 16, 3:29 AM
Unknown Object (File)
Sun, Oct 12, 5:34 AM
Unknown Object (File)
Sun, Oct 12, 5:34 AM
Unknown Object (File)
Sun, Oct 12, 5:34 AM
Unknown Object (File)
Sat, Oct 11, 7:30 PM
Unknown Object (File)
Tue, Oct 7, 11:40 AM
Unknown Object (File)
Mon, Sep 29, 1:40 AM
Unknown Object (File)
Tue, Sep 23, 5:18 AM
Subscribers

Details

Summary
Suppose that the cluster size is larger than page size. If the buffer
at the old EOF (before extending) was partial and dirty, it cannot be
automatically neither written out nor validated by the buffer cache,
since extending buffer adds invalid pages at the end.

Correct the buffer state by calling vfs_bio_clrbuf() on it, to mark
newly added and zeroed pages as valid.

Note that UFS is immune to the problem because ffs_truncate() always
allocate the block and buffer for the last byte of the file.

PR:     269341
In collaboration with:  pho
msdosfs: correct handling of vnode pager size on file extension error

If extension fails, vnode pager recorded size might be left increased.
Only update vnode pager when extension is past the point of no rollback.
allocbuf(): convert direct panic() calls to KASSERT()s

Also do minor style adjustments.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable