summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/gofer
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-09-10 01:42:15 +0000
committergVisor bot <gvisor-bot@google.com>2020-09-10 01:42:15 +0000
commita40ebdcb7944050fc94c70f491336deb21768f59 (patch)
tree58adc45d03ba194279a0d3d1180cb8c1e25af6b4 /pkg/sentry/fsimpl/gofer
parent4fec9ed0c6c6dde8a13707a0e98b06208f4373dc (diff)
parent2c7df1a9a5cd5288404308e8f0775499d68a0b13 (diff)
Merge release-20200818.0-146-g2c7df1a9a (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/gofer')
-rw-r--r--pkg/sentry/fsimpl/gofer/gofer.go41
1 files changed, 10 insertions, 31 deletions
diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go
index fa4e19113..0e21c31a4 100644
--- a/pkg/sentry/fsimpl/gofer/gofer.go
+++ b/pkg/sentry/fsimpl/gofer/gofer.go
@@ -195,11 +195,7 @@ const (
// and consistent with Linux's semantics (in particular, it is not always
// possible for clients to set arbitrary atimes and mtimes depending on the
// remote filesystem implementation, and never possible for clients to set
- // arbitrary ctimes.) If a dentry containing a client-defined atime or
- // mtime is evicted from cache, client timestamps will be sent to the
- // remote filesystem on a best-effort basis to attempt to ensure that
- // timestamps will be preserved when another dentry representing the same
- // file is instantiated.
+ // arbitrary ctimes.)
InteropModeExclusive InteropMode = iota
// InteropModeWritethrough is appropriate when there are read-only users of
@@ -1315,32 +1311,15 @@ func (d *dentry) destroyLocked(ctx context.Context) {
d.handleMu.Unlock()
if !d.file.isNil() {
- valid := p9.SetAttrMask{}
- attr := p9.SetAttr{}
- if !d.isDeleted() {
- // Write dirty timestamps back to the remote filesystem.
- if atomic.LoadUint32(&d.atimeDirty) != 0 {
- valid.ATime = true
- valid.ATimeNotSystemTime = true
- atime := atomic.LoadInt64(&d.atime)
- attr.ATimeSeconds = uint64(atime / 1e9)
- attr.ATimeNanoSeconds = uint64(atime % 1e9)
- }
- if atomic.LoadUint32(&d.mtimeDirty) != 0 {
- valid.MTime = true
- valid.MTimeNotSystemTime = true
- mtime := atomic.LoadInt64(&d.mtime)
- attr.MTimeSeconds = uint64(mtime / 1e9)
- attr.MTimeNanoSeconds = uint64(mtime % 1e9)
- }
- }
-
- // Check if attributes need to be changed before closing the file.
- if valid.ATime || valid.MTime {
- if err := d.file.setAttrClose(ctx, valid, attr); err != nil {
- log.Warningf("gofer.dentry.destroyLocked: failed to close file with write dirty timestamps: %v", err)
- }
- } else if err := d.file.close(ctx); err != nil {
+ // Note that it's possible that d.atimeDirty or d.mtimeDirty are true,
+ // i.e. client and server timestamps may differ (because e.g. a client
+ // write was serviced by the page cache, and only written back to the
+ // remote file later). Ideally, we'd write client timestamps back to
+ // the remote filesystem so that timestamps for a new dentry
+ // instantiated for the same file would remain coherent. Unfortunately,
+ // this turns out to be too expensive in many cases, so for now we
+ // don't do this.
+ if err := d.file.close(ctx); err != nil {
log.Warningf("gofer.dentry.destroyLocked: failed to close file: %v", err)
}
d.file = p9file{}