From 542bf44f1d03674a5c1173f22f0210080f677ed7 Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Tue, 25 Feb 2025 16:00:29 -0500 Subject: [PATCH 1/2] fix mounting --- internal/backend/arpc/fs.go | 22 ++-------------------- internal/backend/arpc/fuse/fuse.go | 12 ++++++------ 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/internal/backend/arpc/fs.go b/internal/backend/arpc/fs.go index 4d1423b..5218b87 100644 --- a/internal/backend/arpc/fs.go +++ b/internal/backend/arpc/fs.go @@ -10,8 +10,6 @@ import ( "time" "github.com/go-git/go-billy/v5" - "github.com/hanwen/go-fuse/v2/fs" - gofuse "github.com/hanwen/go-fuse/v2/fuse" "github.com/sonroyaalmerol/pbs-plus/internal/arpc" "github.com/sonroyaalmerol/pbs-plus/internal/backend/arpc/fuse" "github.com/sonroyaalmerol/pbs-plus/internal/syslog" @@ -31,24 +29,8 @@ func NewARPCFS(ctx context.Context, session *arpc.Session, hostname string, driv } func (f *ARPCFS) Mount(mountpoint string) error { - timeout := 5 * time.Second - - options := &fs.Options{ - MountOptions: gofuse.MountOptions{ - Debug: false, - FsName: utils.Slugify(f.hostname) + "/" + f.drive, - Name: "pbsagent", - AllowOther: true, - }, - // Use sensible cache timeouts - EntryTimeout: &timeout, - AttrTimeout: &timeout, - NegativeTimeout: &timeout, - } - - root := fuse.New(f, nil) - - server, err := fs.Mount(mountpoint, root, options) + fsName := utils.Slugify(f.hostname) + "/" + f.drive + server, err := fuse.Mount(mountpoint, fsName, f, nil) if err != nil { return err } diff --git a/internal/backend/arpc/fuse/fuse.go b/internal/backend/arpc/fuse/fuse.go index 8f5b973..bb34a96 100644 --- a/internal/backend/arpc/fuse/fuse.go +++ b/internal/backend/arpc/fuse/fuse.go @@ -19,8 +19,7 @@ import ( // CallHook is the callback called before every FUSE operation type CallHook func(ctx context.Context) error -// New creates a FUSE filesystem that passes all calls through to the given billy filesystem. -func New(underlying billy.Basic, callHook CallHook) fs.InodeEmbedder { +func newRoot(underlying billy.Basic, callHook CallHook) fs.InodeEmbedder { if callHook == nil { callHook = func(ctx context.Context) error { return nil @@ -34,15 +33,16 @@ func New(underlying billy.Basic, callHook CallHook) fs.InodeEmbedder { // Mount mounts the billy filesystem at the specified mountpoint func Mount(mountpoint string, fsName string, underlying billy.Basic, callHook CallHook) (*fuse.Server, error) { - root := New(underlying, callHook) + root := newRoot(underlying, callHook) timeout := time.Second options := &fs.Options{ MountOptions: fuse.MountOptions{ - Debug: false, - FsName: fsName, - Name: "pbsagent", + Debug: false, + FsName: fsName, + Name: "pbsagent", + AllowOther: true, }, // Use sensible cache timeouts EntryTimeout: &timeout, From 0e870b9f8d4a25cf32bfe74f3f8ac02265ccb92e Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Tue, 25 Feb 2025 16:01:17 -0500 Subject: [PATCH 2/2] increase timeout to 3 --- internal/backend/arpc/fuse/fuse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/backend/arpc/fuse/fuse.go b/internal/backend/arpc/fuse/fuse.go index bb34a96..6592d32 100644 --- a/internal/backend/arpc/fuse/fuse.go +++ b/internal/backend/arpc/fuse/fuse.go @@ -35,7 +35,7 @@ func newRoot(underlying billy.Basic, callHook CallHook) fs.InodeEmbedder { func Mount(mountpoint string, fsName string, underlying billy.Basic, callHook CallHook) (*fuse.Server, error) { root := newRoot(underlying, callHook) - timeout := time.Second + timeout := 3 * time.Second options := &fs.Options{ MountOptions: fuse.MountOptions{