mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Update cached file size when cache is skipped
gofer.dentryReadWriter.WriteFromBlocks was not updating gofer.dentry.size after a write operation that skips the cache. Updates #1198 PiperOrigin-RevId: 298708646
This commit is contained in:
committed by
gVisor bot
parent
371abe00f0
commit
122d47aed1
@@ -361,8 +361,15 @@ func (rw *dentryReadWriter) WriteFromBlocks(srcs safemem.BlockSeq) (uint64, erro
|
||||
rw.d.handleMu.RLock()
|
||||
if (rw.d.handle.fd >= 0 && !rw.d.fs.opts.forcePageCache) || rw.d.fs.opts.interop == InteropModeShared || rw.direct {
|
||||
n, err := rw.d.handle.writeFromBlocksAt(rw.ctx, srcs, rw.off)
|
||||
rw.d.handleMu.RUnlock()
|
||||
rw.off += n
|
||||
rw.d.dataMu.Lock()
|
||||
if rw.off > rw.d.size {
|
||||
atomic.StoreUint64(&rw.d.size, rw.off)
|
||||
// The remote file's size will implicitly be extended to the correct
|
||||
// value when we write back to it.
|
||||
}
|
||||
rw.d.dataMu.Unlock()
|
||||
rw.d.handleMu.RUnlock()
|
||||
return n, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user