Release implements vfs.FileDescriptionImpl.Release.
(ctx context.Context)
| 68 | |
| 69 | // Release implements vfs.FileDescriptionImpl.Release. |
| 70 | func (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. |
| 98 | func (fd *fileDescription) OnClose(ctx context.Context) error { |
nothing calls this directly
no test coverage detected