Skip to content

Commit

Permalink
Integrated PFSAgent with package fission
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed McClanahan committed Dec 27, 2019
1 parent aebbbd6 commit b90abcf
Show file tree
Hide file tree
Showing 32 changed files with 8,709 additions and 1,697 deletions.
6 changes: 4 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import:
version: 1.1.0
- package: github.com/swiftstack/sortedmap
version: 1.6.1
- package: github.com/swiftstack/fission
version: 1.0.3
- package: bazil.org/fuse
version: 371fbbdaa8987b715bdd21d6adc4c9b20155f748
subpackages:
Expand Down
20 changes: 20 additions & 0 deletions jrpcfs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,26 @@ type LookupRequest struct {
Basename string
}

// LookupPlusRequest is the request object for RpcLookupPlus.
type LookupPlusRequest struct {
InodeHandle
Basename string
}

// LookupPlusReply is the reply object for RpcLookupPlus.
type LookupPlusReply struct {
InodeNumber int64
StatStruct
}

// AccessRequest is the request object for RpcAccess.
type AccessRequest struct {
InodeHandle
UserID int32
GroupID int32
AccessMode uint32
}

// MkdirRequest is the request object for RpcMkdir.
type MkdirRequest struct {
InodeHandle
Expand Down
57 changes: 55 additions & 2 deletions jrpcfs/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,58 @@ func (s *Server) RpcLookup(in *LookupRequest, reply *InodeReply) (err error) {
return
}

func (s *Server) RpcLookupPlus(in *LookupPlusRequest, reply *LookupPlusReply) (err error) {
enterGate()
defer leaveGate()

flog := logger.TraceEnter("in.", in)
defer func() { flog.TraceExitErr("reply.", err, reply) }()
defer func() { rpcEncodeError(&err) }() // Encode error for return by RPC

mountHandle, err := lookupMountHandleByMountIDAsString(in.MountID)
if nil != err {
return
}

ino, err := mountHandle.Lookup(inode.InodeRootUserID, inode.InodeGroupID(0), nil, inode.InodeNumber(in.InodeNumber), in.Basename)
if nil != err {
return
}

stat, err := mountHandle.Getstat(inode.InodeRootUserID, inode.InodeGroupID(0), nil, ino)
if nil != err {
return
}

reply.InodeNumber = int64(uint64(ino))
reply.StatStruct.fsStatToStatStruct(stat)

return
}

func (s *Server) RpcAccess(in *AccessRequest, reply *InodeReply) (err error) {
enterGate()
defer leaveGate()

flog := logger.TraceEnter("in.", in)
defer func() { flog.TraceExitErr("reply.", err, reply) }()
defer func() { rpcEncodeError(&err) }() // Encode error for return by RPC

mountHandle, err := lookupMountHandleByMountIDAsString(in.MountID)
if nil != err {
return
}

ok := mountHandle.Access(inode.InodeUserID(in.UserID), inode.InodeGroupID(in.GroupID), nil, inode.InodeNumber(in.InodeNumber), inode.InodeMode(in.AccessMode))
if ok {
err = nil
} else {
err = blunder.NewError(blunder.PermDeniedError, "EACCES")
}

return
}

func (s *Server) RpcMkdir(in *MkdirRequest, reply *InodeReply) (err error) {
enterGate()
defer leaveGate()
Expand Down Expand Up @@ -1929,7 +1981,7 @@ func (s *Server) RpcStatVFS(in *StatVFSRequest, reply *StatVFS) (err error) {
return
}

func (s *Server) RpcSymlink(in *SymlinkRequest, reply *Reply) (err error) {
func (s *Server) RpcSymlink(in *SymlinkRequest, reply *InodeReply) (err error) {
enterGate()
defer leaveGate()

Expand All @@ -1942,7 +1994,8 @@ func (s *Server) RpcSymlink(in *SymlinkRequest, reply *Reply) (err error) {
return
}

_, err = mountHandle.Symlink(inode.InodeUserID(in.UserID), inode.InodeGroupID(in.GroupID), nil, inode.InodeNumber(in.InodeNumber), in.Basename, in.Target)
ino, err := mountHandle.Symlink(inode.InodeUserID(in.UserID), inode.InodeGroupID(in.GroupID), nil, inode.InodeNumber(in.InodeNumber), in.Basename, in.Target)
reply.InodeNumber = int64(uint64(ino))
return
}

Expand Down
4 changes: 4 additions & 0 deletions pfs_middleware/pfs_middleware/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import uuid

allow_read_only = {
"Server.RpcAccess",
"Server.RpcFetchExtentMapChunk",
"Server.RpcGetAccount",
"Server.RpcGetContainer",
Expand All @@ -32,6 +33,7 @@
"Server.RpcGetXAttr",
"Server.RpcListXAttr",
"Server.RpcLookup",
"Server.RpcLookupPlus",
"Server.RpcMountByAccountName",
"Server.RpcMountByVolumeName",
"Server.RpcPing",
Expand All @@ -45,6 +47,7 @@
}

allow_read_write = {
"Server.RpcAccess",
"Server.RpcChmod",
"Server.RpcChown",
"Server.RpcCreate",
Expand All @@ -61,6 +64,7 @@
"Server.RpcListXAttr",
"Server.RpcLog",
"Server.RpcLookup",
"Server.RpcLookupPlus",
"Server.RpcMiddlewareMkdir",
"Server.RpcMiddlewarePost",
"Server.RpcMkdir",
Expand Down
8 changes: 6 additions & 2 deletions pfsagentd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,20 @@ ExclusiveFileLimit: 100
DirtyFileLimit: 50
MaxFlushSize: 10485760
MaxFlushTime: 10s
ReadOnly: false
LogFilePath: # Unless starting with '/', relative to $CWD; Blank to disable
LogToConsole: true
TraceEnabled: false
HTTPServerIPAddr: 127.0.0.1
HTTPServerTCPPort: 9090
ReadDirPlusEnabled: false
XAttrEnabled: false
EntryDuration: 10s
AttrDuration: 10s
AttrBlockSize: 65536
LookupEntryDuration: 10s
ReaddirMaxEntries: 1024
FUSEMaxBackground: 100
FUSECongestionThreshhold: 0
FUSEMaxWrite: 131072 # Linux max is 128KiB
```

In the above example, some important fields are as follows:
Expand Down
Loading

0 comments on commit b90abcf

Please sign in to comment.