summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/ext/block_map_file.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/ext/block_map_file.go')
-rw-r--r--pkg/sentry/fs/ext/block_map_file.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/sentry/fs/ext/block_map_file.go b/pkg/sentry/fs/ext/block_map_file.go
index eb0b35e36..9aabbd145 100644
--- a/pkg/sentry/fs/ext/block_map_file.go
+++ b/pkg/sentry/fs/ext/block_map_file.go
@@ -16,6 +16,7 @@ package ext
import (
"io"
+ "sync"
"gvisor.dev/gvisor/pkg/binary"
)
@@ -25,10 +26,13 @@ import (
type blockMapFile struct {
regFile regularFile
+ // mu serializes changes to fileToPhysBlks.
+ mu sync.RWMutex
+
// fileToPhysBlks maps the file block numbers to the physical block numbers.
// the physical block number for the (i)th file block is stored in the (i)th
// index. This is initialized (at max) with the first 12 entries. The rest
- // have to be read in from disk when required.
+ // have to be read in from disk when required. Protected by mu.
fileToPhysBlks []uint32
}
@@ -36,7 +40,7 @@ type blockMapFile struct {
var _ fileReader = (*blockMapFile)(nil)
// Read implements fileReader.getFileReader.
-func (f *blockMapFile) getFileReader(dev io.ReadSeeker, blkSize uint64, offset uint64) io.Reader {
+func (f *blockMapFile) getFileReader(dev io.ReaderAt, blkSize uint64, offset uint64) io.Reader {
panic("unimplemented")
}