summaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
Diffstat (limited to 'fastos')
-rw-r--r--fastos/src/vespa/fastos/linux_file.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp
index 9452d1f50f9..8d1b76404b8 100644
--- a/fastos/src/vespa/fastos/linux_file.cpp
+++ b/fastos/src/vespa/fastos/linux_file.cpp
@@ -330,6 +330,10 @@ FastOS_Linux_File::DirectIOPadding (int64_t offset,
size_t &padAfter)
{
if (_directIOEnabled) {
+ if (offset+length > _cachedSize) {
+ // _cachedSize is not really trustworthy, so if we suspect it is not correct, we correct it.
+ _cachedSize = GetSize();
+ }
padBefore = offset & (_directIOFileAlign - 1);
padAfter = _directIOFileAlign - ((padBefore + length) & (_directIOFileAlign - 1));