diff --git a/connection.go b/connection.go index 5b3c4ec3..dfbb856b 100644 --- a/connection.go +++ b/connection.go @@ -525,12 +525,13 @@ func (c *Connection) Reply(ctx context.Context, opErr error) error { noResponse := c.kernelResponse(outMsg, inMsg.Header().Unique, op, opErr) if !noResponse { - // writev is not atomic - writeLock.Lock() - defer writeLock.Unlock() - var err error if outMsg.Sglist != nil { + if fusekernel.IsPlatformFuseT { + // writev is not atomic on macos, restrict to fuse-t platform + writeLock.Lock() + defer writeLock.Unlock() + } _, err = writev(int(c.dev.Fd()), outMsg.Sglist) } else { err = c.writeMessage(outMsg.OutHeaderBytes()) diff --git a/samples/roloopbackfs/inode.go b/samples/roloopbackfs/inode.go index 11854f8c..fbde3f27 100644 --- a/samples/roloopbackfs/inode.go +++ b/samples/roloopbackfs/inode.go @@ -116,12 +116,12 @@ func (in *inodeEntry) ListChildren(inodes *sync.Map) ([]*fuseutil.Dirent, error) if err != nil { return nil, err } - dirents := make([]*fuseutil.Dirent, len(children)) + dirents := []*fuseutil.Dirent{} for i, child := range children { childInode, err := getOrCreateInode(inodes, in.id, child.Name()) if err != nil || childInode == nil { - return nil, nil + continue } var childType fuseutil.DirentType @@ -133,12 +133,12 @@ func (in *inodeEntry) ListChildren(inodes *sync.Map) ([]*fuseutil.Dirent, error) childType = fuseutil.DT_File } - dirents[i] = &fuseutil.Dirent{ + dirents = append(dirents, &fuseutil.Dirent{ Offset: fuseops.DirOffset(i + 1), Inode: childInode.Id(), Name: child.Name(), Type: childType, - } + }) } return dirents, nil }