mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Issue FUSE_FLUSH request during file close.
PiperOrigin-RevId: 571178563
This commit is contained in:
committed by
gVisor bot
parent
f3de61deed
commit
6c24ab8dd8
@@ -1124,3 +1124,14 @@ type FUSEFallocateIn struct {
|
||||
// padding
|
||||
_ uint32
|
||||
}
|
||||
|
||||
// FUSEFlushIn is the request sent by the kernel to the daemon after a file is
|
||||
// closed.
|
||||
//
|
||||
// +marshal
|
||||
type FUSEFlushIn struct {
|
||||
Fh uint64
|
||||
_ uint32 // unused
|
||||
_ uint32 // padding
|
||||
LockOwner uint64
|
||||
}
|
||||
|
||||
@@ -92,6 +92,21 @@ func (fd *fileDescription) Release(ctx context.Context) {
|
||||
conn.CallAsync(ctx, req)
|
||||
}
|
||||
|
||||
// OnClose implements vfs.FileDescriptionImpl.OnClose.
|
||||
func (fd *fileDescription) OnClose(ctx context.Context) error {
|
||||
inode := fd.inode()
|
||||
conn := inode.fs.conn
|
||||
inode.attrMu.Lock()
|
||||
defer inode.attrMu.Unlock()
|
||||
|
||||
in := linux.FUSEFlushIn{
|
||||
Fh: fd.Fh,
|
||||
LockOwner: 0, // TODO(gvisor.dev/issue/3245): file lock
|
||||
}
|
||||
req := conn.NewRequest(auth.CredentialsFromContext(ctx), pidFromContext(ctx), inode.nodeID, linux.FUSE_FLUSH, &in)
|
||||
return conn.CallAsync(ctx, req)
|
||||
}
|
||||
|
||||
// PRead implements vfs.FileDescriptionImpl.PRead.
|
||||
func (fd *fileDescription) PRead(ctx context.Context, dst usermem.IOSequence, offset int64, opts vfs.ReadOptions) (int64, error) {
|
||||
return 0, nil
|
||||
|
||||
Reference in New Issue
Block a user