summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/gofer/handle.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-07 19:59:27 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-07 19:59:27 +0000
commit90071d4e7f86f9c452969ebc38a3a64c27e37bf0 (patch)
tree8cd860d3bb992e9e5e93fc72ddba232b55b7f8ac /pkg/sentry/fsimpl/gofer/handle.go
parentb70f9919d048a7ff29740fa652bf890660922543 (diff)
parent93cb66825bf098f8a19b3d7f34b33272ceed8cb3 (diff)
Merge release-20200804.0-39-g93cb66825 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/gofer/handle.go')
-rw-r--r--pkg/sentry/fsimpl/gofer/handle.go19
1 files changed, 4 insertions, 15 deletions
diff --git a/pkg/sentry/fsimpl/gofer/handle.go b/pkg/sentry/fsimpl/gofer/handle.go
index 8792ca4f2..104157512 100644
--- a/pkg/sentry/fsimpl/gofer/handle.go
+++ b/pkg/sentry/fsimpl/gofer/handle.go
@@ -63,6 +63,10 @@ func openHandle(ctx context.Context, file p9file, read, write, trunc bool) (hand
}, nil
}
+func (h *handle) isOpen() bool {
+ return !h.file.isNil()
+}
+
func (h *handle) close(ctx context.Context) {
h.file.close(ctx)
h.file = p9file{}
@@ -124,18 +128,3 @@ func (h *handle) writeFromBlocksAt(ctx context.Context, srcs safemem.BlockSeq, o
}
return cp, cperr
}
-
-func (h *handle) sync(ctx context.Context) error {
- // Handle most common case first.
- if h.fd >= 0 {
- ctx.UninterruptibleSleepStart(false)
- err := syscall.Fsync(int(h.fd))
- ctx.UninterruptibleSleepFinish(false)
- return err
- }
- if h.file.isNil() {
- // File hasn't been touched, there is nothing to sync.
- return nil
- }
- return h.file.fsync(ctx)
-}