Add pid in all fuse ops (#92)
Expose PID as metadata in CreateFile, OpenFile and FlushFile operations This will help us with kahing/goofys#273 Co-authored-by: Sai Teja Suram <pratap130492@gmail.com> Co-authored-by: Sai Teja Suram <pts@avah.dev>geesefs-0-30-9
parent
f8927095af
commit
36e01f1b3a
|
@ -52,11 +52,13 @@ func convertInMessage(
|
||||||
o = &fuseops.LookUpInodeOp{
|
o = &fuseops.LookUpInodeOp{
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(buf[:n-1]),
|
Name: string(buf[:n-1]),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpGetattr:
|
case fusekernel.OpGetattr:
|
||||||
o = &fuseops.GetInodeAttributesOp{
|
o = &fuseops.GetInodeAttributesOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpSetattr:
|
case fusekernel.OpSetattr:
|
||||||
|
@ -68,6 +70,7 @@ func convertInMessage(
|
||||||
|
|
||||||
to := &fuseops.SetInodeAttributesOp{
|
to := &fuseops.SetInodeAttributesOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
o = to
|
o = to
|
||||||
|
|
||||||
|
@ -106,6 +109,7 @@ func convertInMessage(
|
||||||
o = &fuseops.ForgetInodeOp{
|
o = &fuseops.ForgetInodeOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
N: in.Nlookup,
|
N: in.Nlookup,
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpMkdir:
|
case fusekernel.OpMkdir:
|
||||||
|
@ -132,6 +136,7 @@ func convertInMessage(
|
||||||
// opcode is mkdir. But we want the correct mode to go through, so ensure
|
// opcode is mkdir. But we want the correct mode to go through, so ensure
|
||||||
// that os.ModeDir is set.
|
// that os.ModeDir is set.
|
||||||
Mode: convertFileMode(in.Mode) | os.ModeDir,
|
Mode: convertFileMode(in.Mode) | os.ModeDir,
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpMknod:
|
case fusekernel.OpMknod:
|
||||||
|
@ -151,6 +156,7 @@ func convertInMessage(
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(name),
|
Name: string(name),
|
||||||
Mode: convertFileMode(in.Mode),
|
Mode: convertFileMode(in.Mode),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpCreate:
|
case fusekernel.OpCreate:
|
||||||
|
@ -170,6 +176,7 @@ func convertInMessage(
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(name),
|
Name: string(name),
|
||||||
Mode: convertFileMode(in.Mode),
|
Mode: convertFileMode(in.Mode),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpSymlink:
|
case fusekernel.OpSymlink:
|
||||||
|
@ -188,6 +195,7 @@ func convertInMessage(
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(newName),
|
Name: string(newName),
|
||||||
Target: string(target),
|
Target: string(target),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpRename:
|
case fusekernel.OpRename:
|
||||||
|
@ -216,6 +224,7 @@ func convertInMessage(
|
||||||
OldName: string(oldName),
|
OldName: string(oldName),
|
||||||
NewParent: fuseops.InodeID(in.Newdir),
|
NewParent: fuseops.InodeID(in.Newdir),
|
||||||
NewName: string(newName),
|
NewName: string(newName),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpUnlink:
|
case fusekernel.OpUnlink:
|
||||||
|
@ -228,6 +237,7 @@ func convertInMessage(
|
||||||
o = &fuseops.UnlinkOp{
|
o = &fuseops.UnlinkOp{
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(buf[:n-1]),
|
Name: string(buf[:n-1]),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpRmdir:
|
case fusekernel.OpRmdir:
|
||||||
|
@ -240,16 +250,19 @@ func convertInMessage(
|
||||||
o = &fuseops.RmDirOp{
|
o = &fuseops.RmDirOp{
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(buf[:n-1]),
|
Name: string(buf[:n-1]),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpOpen:
|
case fusekernel.OpOpen:
|
||||||
o = &fuseops.OpenFileOp{
|
o = &fuseops.OpenFileOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpOpendir:
|
case fusekernel.OpOpendir:
|
||||||
o = &fuseops.OpenDirOp{
|
o = &fuseops.OpenDirOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpRead:
|
case fusekernel.OpRead:
|
||||||
|
@ -262,6 +275,7 @@ func convertInMessage(
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
Offset: int64(in.Offset),
|
Offset: int64(in.Offset),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
o = to
|
o = to
|
||||||
|
|
||||||
|
@ -286,6 +300,7 @@ func convertInMessage(
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
Offset: fuseops.DirOffset(in.Offset),
|
Offset: fuseops.DirOffset(in.Offset),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
o = to
|
o = to
|
||||||
|
|
||||||
|
@ -309,6 +324,7 @@ func convertInMessage(
|
||||||
|
|
||||||
o = &fuseops.ReleaseFileHandleOp{
|
o = &fuseops.ReleaseFileHandleOp{
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpReleasedir:
|
case fusekernel.OpReleasedir:
|
||||||
|
@ -320,6 +336,7 @@ func convertInMessage(
|
||||||
|
|
||||||
o = &fuseops.ReleaseDirHandleOp{
|
o = &fuseops.ReleaseDirHandleOp{
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpWrite:
|
case fusekernel.OpWrite:
|
||||||
|
@ -338,6 +355,7 @@ func convertInMessage(
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
Data: buf,
|
Data: buf,
|
||||||
Offset: int64(in.Offset),
|
Offset: int64(in.Offset),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpFsync:
|
case fusekernel.OpFsync:
|
||||||
|
@ -350,6 +368,7 @@ func convertInMessage(
|
||||||
o = &fuseops.SyncFileOp{
|
o = &fuseops.SyncFileOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpFlush:
|
case fusekernel.OpFlush:
|
||||||
|
@ -362,11 +381,13 @@ func convertInMessage(
|
||||||
o = &fuseops.FlushFileOp{
|
o = &fuseops.FlushFileOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Handle: fuseops.HandleID(in.Fh),
|
Handle: fuseops.HandleID(in.Fh),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpReadlink:
|
case fusekernel.OpReadlink:
|
||||||
o = &fuseops.ReadSymlinkOp{
|
o = &fuseops.ReadSymlinkOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpStatfs:
|
case fusekernel.OpStatfs:
|
||||||
|
@ -417,6 +438,7 @@ func convertInMessage(
|
||||||
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
Parent: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(name),
|
Name: string(name),
|
||||||
Target: fuseops.InodeID(in.Oldnodeid),
|
Target: fuseops.InodeID(in.Oldnodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpRemovexattr:
|
case fusekernel.OpRemovexattr:
|
||||||
|
@ -429,6 +451,7 @@ func convertInMessage(
|
||||||
o = &fuseops.RemoveXattrOp{
|
o = &fuseops.RemoveXattrOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(buf[:n-1]),
|
Name: string(buf[:n-1]),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
case fusekernel.OpGetxattr:
|
case fusekernel.OpGetxattr:
|
||||||
|
@ -448,6 +471,7 @@ func convertInMessage(
|
||||||
to := &fuseops.GetXattrOp{
|
to := &fuseops.GetXattrOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
Name: string(name),
|
Name: string(name),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
o = to
|
o = to
|
||||||
|
|
||||||
|
@ -471,6 +495,7 @@ func convertInMessage(
|
||||||
|
|
||||||
to := &fuseops.ListXattrOp{
|
to := &fuseops.ListXattrOp{
|
||||||
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
o = to
|
o = to
|
||||||
|
|
||||||
|
@ -509,6 +534,7 @@ func convertInMessage(
|
||||||
Name: string(name),
|
Name: string(name),
|
||||||
Value: value,
|
Value: value,
|
||||||
Flags: in.Flags,
|
Flags: in.Flags,
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
case fusekernel.OpFallocate:
|
case fusekernel.OpFallocate:
|
||||||
type input fusekernel.FallocateIn
|
type input fusekernel.FallocateIn
|
||||||
|
@ -523,6 +549,7 @@ func convertInMessage(
|
||||||
Offset: in.Offset,
|
Offset: in.Offset,
|
||||||
Length: in.Length,
|
Length: in.Length,
|
||||||
Mode: in.Mode,
|
Mode: in.Mode,
|
||||||
|
OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid},
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
6
debug.go
6
debug.go
|
@ -55,6 +55,12 @@ func describeRequest(op interface{}) (s string) {
|
||||||
addComponent("name %q", f.Interface())
|
addComponent("name %q", f.Interface())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if f := v.FieldByName("OpContext"); f.IsValid() {
|
||||||
|
if meta, ok := f.Interface().(fuseops.OpContext); ok {
|
||||||
|
addComponent("PID %+v", meta.Pid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle special cases.
|
// Handle special cases.
|
||||||
switch typed := op.(type) {
|
switch typed := op.(type) {
|
||||||
case *interruptOp:
|
case *interruptOp:
|
||||||
|
|
|
@ -23,6 +23,14 @@ import (
|
||||||
// File system
|
// File system
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// OpContext contains extra context that may be needed by some file systems.
|
||||||
|
// See https://libfuse.github.io/doxygen/structfuse__context.html as a reference.
|
||||||
|
type OpContext struct {
|
||||||
|
// PID of the process that is invoking the operation.
|
||||||
|
// Not filled in case of a writepage operation.
|
||||||
|
Pid uint32
|
||||||
|
}
|
||||||
|
|
||||||
// Return statistics about the file system's capacity and available resources.
|
// Return statistics about the file system's capacity and available resources.
|
||||||
//
|
//
|
||||||
// Called by statfs(2) and friends:
|
// Called by statfs(2) and friends:
|
||||||
|
@ -120,6 +128,7 @@ type LookUpInodeOp struct {
|
||||||
// The lookup count for the inode is implicitly incremented. See notes on
|
// The lookup count for the inode is implicitly incremented. See notes on
|
||||||
// ForgetInodeOp for more information.
|
// ForgetInodeOp for more information.
|
||||||
Entry ChildInodeEntry
|
Entry ChildInodeEntry
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the attributes for an inode whose ID was previously returned in a
|
// Refresh the attributes for an inode whose ID was previously returned in a
|
||||||
|
@ -135,6 +144,7 @@ type GetInodeAttributesOp struct {
|
||||||
// more.
|
// more.
|
||||||
Attributes InodeAttributes
|
Attributes InodeAttributes
|
||||||
AttributesExpiration time.Time
|
AttributesExpiration time.Time
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change attributes for an inode.
|
// Change attributes for an inode.
|
||||||
|
@ -159,6 +169,7 @@ type SetInodeAttributesOp struct {
|
||||||
// ChildInodeEntry.AttributesExpiration for more.
|
// ChildInodeEntry.AttributesExpiration for more.
|
||||||
Attributes InodeAttributes
|
Attributes InodeAttributes
|
||||||
AttributesExpiration time.Time
|
AttributesExpiration time.Time
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrement the reference count for an inode ID previously issued by the file
|
// Decrement the reference count for an inode ID previously issued by the file
|
||||||
|
@ -206,6 +217,7 @@ type ForgetInodeOp struct {
|
||||||
|
|
||||||
// The amount to decrement the reference count.
|
// The amount to decrement the reference count.
|
||||||
N uint64
|
N uint64
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -236,6 +248,7 @@ type MkDirOp struct {
|
||||||
// The lookup count for the inode is implicitly incremented. See notes on
|
// The lookup count for the inode is implicitly incremented. See notes on
|
||||||
// ForgetInodeOp for more information.
|
// ForgetInodeOp for more information.
|
||||||
Entry ChildInodeEntry
|
Entry ChildInodeEntry
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a file inode as a child of an existing directory inode. The kernel
|
// Create a file inode as a child of an existing directory inode. The kernel
|
||||||
|
@ -263,6 +276,7 @@ type MkNodeOp struct {
|
||||||
// The lookup count for the inode is implicitly incremented. See notes on
|
// The lookup count for the inode is implicitly incremented. See notes on
|
||||||
// ForgetInodeOp for more information.
|
// ForgetInodeOp for more information.
|
||||||
Entry ChildInodeEntry
|
Entry ChildInodeEntry
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a file inode and open it.
|
// Create a file inode and open it.
|
||||||
|
@ -298,6 +312,7 @@ type CreateFileOp struct {
|
||||||
// file handle. The file system must ensure this ID remains valid until a
|
// file handle. The file system must ensure this ID remains valid until a
|
||||||
// later call to ReleaseFileHandle.
|
// later call to ReleaseFileHandle.
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a symlink inode. If the name already exists, the file system should
|
// Create a symlink inode. If the name already exists, the file system should
|
||||||
|
@ -318,6 +333,7 @@ type CreateSymlinkOp struct {
|
||||||
// The lookup count for the inode is implicitly incremented. See notes on
|
// The lookup count for the inode is implicitly incremented. See notes on
|
||||||
// ForgetInodeOp for more information.
|
// ForgetInodeOp for more information.
|
||||||
Entry ChildInodeEntry
|
Entry ChildInodeEntry
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a hard link to an inode. If the name already exists, the file system
|
// Create a hard link to an inode. If the name already exists, the file system
|
||||||
|
@ -338,6 +354,7 @@ type CreateLinkOp struct {
|
||||||
// The lookup count for the inode is implicitly incremented. See notes on
|
// The lookup count for the inode is implicitly incremented. See notes on
|
||||||
// ForgetInodeOp for more information.
|
// ForgetInodeOp for more information.
|
||||||
Entry ChildInodeEntry
|
Entry ChildInodeEntry
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -388,6 +405,7 @@ type RenameOp struct {
|
||||||
// overwritten within it.
|
// overwritten within it.
|
||||||
NewParent InodeID
|
NewParent InodeID
|
||||||
NewName string
|
NewName string
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlink a directory from its parent. Because directories cannot have a link
|
// Unlink a directory from its parent. Because directories cannot have a link
|
||||||
|
@ -402,6 +420,7 @@ type RmDirOp struct {
|
||||||
// removed within it.
|
// removed within it.
|
||||||
Parent InodeID
|
Parent InodeID
|
||||||
Name string
|
Name string
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unlink a file or symlink from its parent. If this brings the inode's link
|
// Unlink a file or symlink from its parent. If this brings the inode's link
|
||||||
|
@ -415,6 +434,7 @@ type UnlinkOp struct {
|
||||||
// within it.
|
// within it.
|
||||||
Parent InodeID
|
Parent InodeID
|
||||||
Name string
|
Name string
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -440,6 +460,7 @@ type OpenDirOp struct {
|
||||||
// directory handle. The file system must ensure this ID remains valid until
|
// directory handle. The file system must ensure this ID remains valid until
|
||||||
// a later call to ReleaseDirHandle.
|
// a later call to ReleaseDirHandle.
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read entries from a directory previously opened with OpenDir.
|
// Read entries from a directory previously opened with OpenDir.
|
||||||
|
@ -532,6 +553,7 @@ type ReadDirOp struct {
|
||||||
// FUSE_DIRENT_ALIGN (http://goo.gl/UziWvH) is less than the read size of
|
// FUSE_DIRENT_ALIGN (http://goo.gl/UziWvH) is less than the read size of
|
||||||
// PAGE_SIZE used by fuse_readdir (cf. https://goo.gl/VajtS2).
|
// PAGE_SIZE used by fuse_readdir (cf. https://goo.gl/VajtS2).
|
||||||
BytesRead int
|
BytesRead int
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release a previously-minted directory handle. The kernel sends this when
|
// Release a previously-minted directory handle. The kernel sends this when
|
||||||
|
@ -547,6 +569,7 @@ type ReleaseDirHandleOp struct {
|
||||||
// be used in further calls to the file system (unless it is reissued by the
|
// be used in further calls to the file system (unless it is reissued by the
|
||||||
// file system).
|
// file system).
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -596,6 +619,8 @@ type OpenFileOp struct {
|
||||||
// layer. This allows for filesystems whose file sizes are not known in
|
// layer. This allows for filesystems whose file sizes are not known in
|
||||||
// advance, for example, because contents are generated on the fly.
|
// advance, for example, because contents are generated on the fly.
|
||||||
UseDirectIO bool
|
UseDirectIO bool
|
||||||
|
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read data from a file previously opened with CreateFile or OpenFile.
|
// Read data from a file previously opened with CreateFile or OpenFile.
|
||||||
|
@ -626,6 +651,7 @@ type ReadFileOp struct {
|
||||||
//
|
//
|
||||||
// If direct IO is enabled, semantics should match those of read(2).
|
// If direct IO is enabled, semantics should match those of read(2).
|
||||||
BytesRead int
|
BytesRead int
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write data to a file previously opened with CreateFile or OpenFile.
|
// Write data to a file previously opened with CreateFile or OpenFile.
|
||||||
|
@ -685,6 +711,7 @@ type WriteFileOp struct {
|
||||||
// because it uses file mmapping machinery (http://goo.gl/SGxnaN) to write a
|
// because it uses file mmapping machinery (http://goo.gl/SGxnaN) to write a
|
||||||
// page at a time.
|
// page at a time.
|
||||||
Data []byte
|
Data []byte
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronize the current contents of an open file to storage.
|
// Synchronize the current contents of an open file to storage.
|
||||||
|
@ -707,6 +734,7 @@ type SyncFileOp struct {
|
||||||
// The file and handle being sync'd.
|
// The file and handle being sync'd.
|
||||||
Inode InodeID
|
Inode InodeID
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the current state of an open file to storage upon closing a file
|
// Flush the current state of an open file to storage upon closing a file
|
||||||
|
@ -761,6 +789,7 @@ type FlushFileOp struct {
|
||||||
// The file and handle being flushed.
|
// The file and handle being flushed.
|
||||||
Inode InodeID
|
Inode InodeID
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release a previously-minted file handle. The kernel calls this when there
|
// Release a previously-minted file handle. The kernel calls this when there
|
||||||
|
@ -776,6 +805,7 @@ type ReleaseFileHandleOp struct {
|
||||||
// be used in further calls to the file system (unless it is reissued by the
|
// be used in further calls to the file system (unless it is reissued by the
|
||||||
// file system).
|
// file system).
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -789,6 +819,7 @@ type ReadSymlinkOp struct {
|
||||||
|
|
||||||
// Set by the file system: the target of the symlink.
|
// Set by the file system: the target of the symlink.
|
||||||
Target string
|
Target string
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -805,6 +836,7 @@ type RemoveXattrOp struct {
|
||||||
|
|
||||||
// The name of the extended attribute.
|
// The name of the extended attribute.
|
||||||
Name string
|
Name string
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get an extended attribute.
|
// Get an extended attribute.
|
||||||
|
@ -826,6 +858,7 @@ type GetXattrOp struct {
|
||||||
// the number of bytes that would have been read into Dst if Dst was
|
// the number of bytes that would have been read into Dst if Dst was
|
||||||
// big enough (return ERANGE in this case).
|
// big enough (return ERANGE in this case).
|
||||||
BytesRead int
|
BytesRead int
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// List all the extended attributes for a file.
|
// List all the extended attributes for a file.
|
||||||
|
@ -846,6 +879,7 @@ type ListXattrOp struct {
|
||||||
// the number of bytes that would have been read into Dst if Dst was
|
// the number of bytes that would have been read into Dst if Dst was
|
||||||
// big enough (return ERANGE in this case).
|
// big enough (return ERANGE in this case).
|
||||||
BytesRead int
|
BytesRead int
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set an extended attribute.
|
// Set an extended attribute.
|
||||||
|
@ -867,6 +901,7 @@ type SetXattrOp struct {
|
||||||
// If Flags is 0x0, the extended attribute will be created if need be, or will
|
// If Flags is 0x0, the extended attribute will be created if need be, or will
|
||||||
// simply replace the value if the attribute exists.
|
// simply replace the value if the attribute exists.
|
||||||
Flags uint32
|
Flags uint32
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
||||||
type FallocateOp struct {
|
type FallocateOp struct {
|
||||||
|
@ -886,4 +921,5 @@ type FallocateOp struct {
|
||||||
// If Mode has 0x2, it sbould also have 0x1 (deallocate should not increase
|
// If Mode has 0x2, it sbould also have 0x1 (deallocate should not increase
|
||||||
// file size)
|
// file size)
|
||||||
Mode uint32
|
Mode uint32
|
||||||
|
OpContext OpContext
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ func (t *SampleTest) SetUp(ti *ogletest.TestInfo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Like SetUp, but doens't panic.
|
// Like SetUp, but doesn't panic.
|
||||||
func (t *SampleTest) initialize(
|
func (t *SampleTest) initialize(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
server fuse.Server,
|
server fuse.Server,
|
||||||
|
|
|
@ -194,6 +194,10 @@ func (fs *memFS) StatFS(
|
||||||
func (fs *memFS) LookUpInode(
|
func (fs *memFS) LookUpInode(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.LookUpInodeOp) error {
|
op *fuseops.LookUpInodeOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -224,6 +228,10 @@ func (fs *memFS) LookUpInode(
|
||||||
func (fs *memFS) GetInodeAttributes(
|
func (fs *memFS) GetInodeAttributes(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.GetInodeAttributesOp) error {
|
op *fuseops.GetInodeAttributesOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -243,6 +251,10 @@ func (fs *memFS) GetInodeAttributes(
|
||||||
func (fs *memFS) SetInodeAttributes(
|
func (fs *memFS) SetInodeAttributes(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.SetInodeAttributesOp) error {
|
op *fuseops.SetInodeAttributesOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -272,6 +284,10 @@ func (fs *memFS) SetInodeAttributes(
|
||||||
func (fs *memFS) MkDir(
|
func (fs *memFS) MkDir(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.MkDirOp) error {
|
op *fuseops.MkDirOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -314,6 +330,10 @@ func (fs *memFS) MkDir(
|
||||||
func (fs *memFS) MkNode(
|
func (fs *memFS) MkNode(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.MkNodeOp) error {
|
op *fuseops.MkNodeOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -371,11 +391,15 @@ func (fs *memFS) createFile(
|
||||||
|
|
||||||
func (fs *memFS) CreateFile(
|
func (fs *memFS) CreateFile(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.CreateFileOp) error {
|
op *fuseops.CreateFileOp) (err error) {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
// CreateFileOp should have a valid pid in context.
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
var err error
|
|
||||||
op.Entry, err = fs.createFile(op.Parent, op.Name, op.Mode)
|
op.Entry, err = fs.createFile(op.Parent, op.Name, op.Mode)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -383,6 +407,10 @@ func (fs *memFS) CreateFile(
|
||||||
func (fs *memFS) CreateSymlink(
|
func (fs *memFS) CreateSymlink(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.CreateSymlinkOp) error {
|
op *fuseops.CreateSymlinkOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -433,6 +461,10 @@ func (fs *memFS) CreateSymlink(
|
||||||
func (fs *memFS) CreateLink(
|
func (fs *memFS) CreateLink(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.CreateLinkOp) error {
|
op *fuseops.CreateLinkOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -472,6 +504,10 @@ func (fs *memFS) CreateLink(
|
||||||
func (fs *memFS) Rename(
|
func (fs *memFS) Rename(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.RenameOp) error {
|
op *fuseops.RenameOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -513,6 +549,10 @@ func (fs *memFS) Rename(
|
||||||
func (fs *memFS) RmDir(
|
func (fs *memFS) RmDir(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.RmDirOp) error {
|
op *fuseops.RmDirOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -545,6 +585,10 @@ func (fs *memFS) RmDir(
|
||||||
func (fs *memFS) Unlink(
|
func (fs *memFS) Unlink(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.UnlinkOp) error {
|
op *fuseops.UnlinkOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -572,6 +616,10 @@ func (fs *memFS) Unlink(
|
||||||
func (fs *memFS) OpenDir(
|
func (fs *memFS) OpenDir(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.OpenDirOp) error {
|
op *fuseops.OpenDirOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -590,6 +638,10 @@ func (fs *memFS) OpenDir(
|
||||||
func (fs *memFS) ReadDir(
|
func (fs *memFS) ReadDir(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.ReadDirOp) error {
|
op *fuseops.ReadDirOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -605,6 +657,11 @@ func (fs *memFS) ReadDir(
|
||||||
func (fs *memFS) OpenFile(
|
func (fs *memFS) OpenFile(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.OpenFileOp) error {
|
op *fuseops.OpenFileOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
// OpenFileOp should have a valid pid in context.
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -623,6 +680,10 @@ func (fs *memFS) OpenFile(
|
||||||
func (fs *memFS) ReadFile(
|
func (fs *memFS) ReadFile(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.ReadFileOp) error {
|
op *fuseops.ReadFileOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -644,6 +705,10 @@ func (fs *memFS) ReadFile(
|
||||||
func (fs *memFS) WriteFile(
|
func (fs *memFS) WriteFile(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.WriteFileOp) error {
|
op *fuseops.WriteFileOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -656,9 +721,23 @@ func (fs *memFS) WriteFile(
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fs *memFS) FlushFile(
|
||||||
|
ctx context.Context,
|
||||||
|
op *fuseops.FlushFileOp) (err error) {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
// FlushFileOp should have a valid pid in context.
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (fs *memFS) ReadSymlink(
|
func (fs *memFS) ReadSymlink(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
op *fuseops.ReadSymlinkOp) error {
|
op *fuseops.ReadSymlinkOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -673,6 +752,10 @@ func (fs *memFS) ReadSymlink(
|
||||||
|
|
||||||
func (fs *memFS) GetXattr(ctx context.Context,
|
func (fs *memFS) GetXattr(ctx context.Context,
|
||||||
op *fuseops.GetXattrOp) error {
|
op *fuseops.GetXattrOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -693,6 +776,10 @@ func (fs *memFS) GetXattr(ctx context.Context,
|
||||||
|
|
||||||
func (fs *memFS) ListXattr(ctx context.Context,
|
func (fs *memFS) ListXattr(ctx context.Context,
|
||||||
op *fuseops.ListXattrOp) error {
|
op *fuseops.ListXattrOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
|
|
||||||
|
@ -716,6 +803,10 @@ func (fs *memFS) ListXattr(ctx context.Context,
|
||||||
|
|
||||||
func (fs *memFS) RemoveXattr(ctx context.Context,
|
func (fs *memFS) RemoveXattr(ctx context.Context,
|
||||||
op *fuseops.RemoveXattrOp) error {
|
op *fuseops.RemoveXattrOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
inode := fs.getInodeOrDie(op.Inode)
|
inode := fs.getInodeOrDie(op.Inode)
|
||||||
|
@ -730,6 +821,10 @@ func (fs *memFS) RemoveXattr(ctx context.Context,
|
||||||
|
|
||||||
func (fs *memFS) SetXattr(ctx context.Context,
|
func (fs *memFS) SetXattr(ctx context.Context,
|
||||||
op *fuseops.SetXattrOp) error {
|
op *fuseops.SetXattrOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
inode := fs.getInodeOrDie(op.Inode)
|
inode := fs.getInodeOrDie(op.Inode)
|
||||||
|
@ -755,6 +850,10 @@ func (fs *memFS) SetXattr(ctx context.Context,
|
||||||
|
|
||||||
func (fs *memFS) Fallocate(ctx context.Context,
|
func (fs *memFS) Fallocate(ctx context.Context,
|
||||||
op *fuseops.FallocateOp) error {
|
op *fuseops.FallocateOp) error {
|
||||||
|
if op.OpContext.Pid == 0 {
|
||||||
|
return fuse.EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
fs.mu.Lock()
|
fs.mu.Lock()
|
||||||
defer fs.mu.Unlock()
|
defer fs.mu.Unlock()
|
||||||
inode := fs.getInodeOrDie(op.Inode)
|
inode := fs.getInodeOrDie(op.Inode)
|
||||||
|
|
|
@ -97,6 +97,9 @@ type memFSTest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *memFSTest) SetUp(ti *TestInfo) {
|
func (t *memFSTest) SetUp(ti *TestInfo) {
|
||||||
|
// Disable writeback caching so that pid is always available in OpContext
|
||||||
|
t.MountConfig.DisableWritebackCaching = true
|
||||||
|
|
||||||
t.Server = memfs.NewMemFS(currentUid(), currentGid())
|
t.Server = memfs.NewMemFS(currentUid(), currentGid())
|
||||||
t.SampleTest.SetUp(ti)
|
t.SampleTest.SetUp(ti)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue