Skip to content

Commit

Permalink
fix mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Feb 25, 2025
1 parent 751893e commit 542bf44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
22 changes: 2 additions & 20 deletions internal/backend/arpc/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand Down
12 changes: 6 additions & 6 deletions internal/backend/arpc/fuse/fuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 542bf44

Please sign in to comment.