summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/file_state.go
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2018-10-03 17:02:05 -0700
committerShentubot <shentubot@google.com>2018-10-03 17:03:09 -0700
commit4fef31f96c289d5e58c3c2997ee38fcb22c0378f (patch)
treecc05ab5e2841ff987e126095657db94a1492d12b /pkg/sentry/fs/file_state.go
parent9f2ba6ac3e7b56d428ef4369a7326dd85f30642d (diff)
Add S/R support for FIOASYNC
PiperOrigin-RevId: 215655197 Change-Id: I668b1bc7c29daaf2999f8f759138bcbb09c4de6f
Diffstat (limited to 'pkg/sentry/fs/file_state.go')
-rw-r--r--pkg/sentry/fs/file_state.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/sentry/fs/file_state.go b/pkg/sentry/fs/file_state.go
index 3384737ab..f848d1b79 100644
--- a/pkg/sentry/fs/file_state.go
+++ b/pkg/sentry/fs/file_state.go
@@ -14,7 +14,18 @@
package fs
+// beforeSave is invoked by stateify.
+func (f *File) beforeSave() {
+ f.saving = true
+ if f.flags.Async && f.async != nil {
+ f.async.Unregister(f)
+ }
+}
+
// afterLoad is invoked by stateify.
func (f *File) afterLoad() {
f.mu.Init()
+ if f.flags.Async && f.async != nil {
+ f.async.Register(f)
+ }
}