MCPcopy
hub / github.com/google/gvisor / Release

Method Release

pkg/sentry/fsimpl/fuse/file.go:70–95  ·  view source on GitHub ↗

Release implements vfs.FileDescriptionImpl.Release.

(ctx context.Context)

Source from the content-addressed store, hash-verified

68
69// Release implements vfs.FileDescriptionImpl.Release.
70func (fd *fileDescription) Release(ctx context.Context) {
71 // no need to release if FUSE server doesn't implement Open.
72 conn := fd.inode().fs.conn
73 if conn.noOpen {
74 return
75 }
76
77 in := linux.FUSEReleaseIn{
78 Fh: fd.Fh,
79 Flags: fd.statusFlags(),
80 }
81 // TODO(gvisor.dev/issue/3245): add logic when we support file lock owners.
82 inode := fd.inode()
83 inode.attrMu.Lock()
84 defer inode.attrMu.Unlock()
85 var opcode linux.FUSEOpcode
86 if inode.filemode().IsDir() {
87 opcode = linux.FUSE_RELEASEDIR
88 } else {
89 opcode = linux.FUSE_RELEASE
90 }
91 // Ignoring errors and FUSE server replies is analogous to Linux's behavior.
92 req := conn.NewRequest(auth.CredentialsFromContext(ctx), pidFromContext(ctx), inode.nodeID, opcode, &in)
93 // The reply will be ignored since no callback is defined in asyncCallBack().
94 conn.Call(ctx, req)
95}
96
97// OnClose implements vfs.FileDescriptionImpl.OnClose.
98func (fd *fileDescription) OnClose(ctx context.Context) error {

Callers

nothing calls this directly

Calls 10

inodeMethod · 0.95
statusFlagsMethod · 0.95
CredentialsFromContextFunction · 0.92
pidFromContextFunction · 0.85
filemodeMethod · 0.80
NewRequestMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65
IsDirMethod · 0.45
CallMethod · 0.45

Tested by

no test coverage detected