nfs4: zero out possible garbage values
* When a file hole is created, zero the start of the page where the
hole ends.
In my test setup at least, the server takes care of zeroing any full
pages in the hole created when a write begins at a position after the
existing EOF. Since the file cache page where the write starts will be
written back to the server, we just need to partially zero that page.
This change allows the driver to pass the 'holey file' test in the
nfs connectathon test suite.
Change-Id: I5a0d52af5cce4fb9e2d9f928f45fd0adcfa23627
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9381
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Diff
src/add-ons/kernel/file_systems/nfs4/InodeRegular.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -430,6 +430,14 @@
status_t result = file_cache_set_size(fFileCache, fileSize);
if (result != B_OK)
return result;
if (static_cast<uint64>(pos) > ROUNDUP(fMaxFileSize, B_PAGE_SIZE)
&& (cookie->fMode & O_NOCACHE) == 0) {
fMaxFileSize = pos;
size_t pageOffset = pos % B_PAGE_SIZE;
file_cache_write(fFileCache, cookie, pos - pageOffset, NULL, &pageOffset);
}
fMaxFileSize = fileSize;
fMetaCache.GrowFile(fMaxFileSize);
}