summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/tmpfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-11-13 09:54:42 +0000
committergVisor bot <gvisor-bot@google.com>2020-11-13 09:54:42 +0000
commitbf11ab404ae91780ecfa23dd7105c2bf93073c55 (patch)
tree4c3293051c764ff650521d547cbb5adab0b22a7b /pkg/sentry/fsimpl/tmpfs
parent5432054ffc736b2a5b7bb3dde8d6a2b962e7302c (diff)
parente869e2c7cddca0337b6dfb28584b05ee1b225a7f (diff)
Merge release-20201030.0-86-ge869e2c7c (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/tmpfs')
-rw-r--r--pkg/sentry/fsimpl/tmpfs/regular_file.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/fsimpl/tmpfs/regular_file.go b/pkg/sentry/fsimpl/tmpfs/regular_file.go
index 98680fde9..f8e0cffb0 100644
--- a/pkg/sentry/fsimpl/tmpfs/regular_file.go
+++ b/pkg/sentry/fsimpl/tmpfs/regular_file.go
@@ -565,7 +565,7 @@ func (rw *regularFileReadWriter) ReadToBlocks(dsts safemem.BlockSeq) (uint64, er
// WriteFromBlocks implements safemem.Writer.WriteFromBlocks.
//
-// Preconditions: inode.mu must be held.
+// Preconditions: rw.file.inode.mu must be held.
func (rw *regularFileReadWriter) WriteFromBlocks(srcs safemem.BlockSeq) (uint64, error) {
// Hold dataMu so we can modify size.
rw.file.dataMu.Lock()
@@ -657,7 +657,7 @@ exitLoop:
// If the write ends beyond the file's previous size, it causes the
// file to grow.
if rw.off > rw.file.size {
- rw.file.size = rw.off
+ atomic.StoreUint64(&rw.file.size, rw.off)
}
return done, retErr