diff options
author | Jamie Liu <jamieliu@google.com> | 2019-02-28 13:13:38 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-02-28 13:14:43 -0800 |
commit | 05d721f9eec3ad0a430906b968a2876bf37c44a7 (patch) | |
tree | 0db8ad465d97c6a7e81c677840bfb150db5f47d0 /pkg | |
parent | 420a89acd32f8deb0ff62f407c05109a2c378884 (diff) |
Hold dataMu for writing in CachingInodeOperations.WriteOut.
fsutil.SyncDirtyAll mutates the DirtySet.
PiperOrigin-RevId: 236183349
Change-Id: I7e809d5b406ac843407e61eff17d81259a819b4f
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/sentry/fs/fsutil/inode_cached.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/sentry/fs/fsutil/inode_cached.go b/pkg/sentry/fs/fsutil/inode_cached.go index 5e7e861d2..e3b52e943 100644 --- a/pkg/sentry/fs/fsutil/inode_cached.go +++ b/pkg/sentry/fs/fsutil/inode_cached.go @@ -322,9 +322,9 @@ func (c *CachingInodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) c.attrMu.Lock() // Write dirty pages back. - c.dataMu.RLock() + c.dataMu.Lock() err := SyncDirtyAll(ctx, &c.cache, &c.dirty, uint64(c.attr.Size), c.platform.Memory(), c.backingFile.WriteFromBlocksAt) - c.dataMu.RUnlock() + c.dataMu.Unlock() if err != nil { c.attrMu.Unlock() return err |