mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add disableXAttr in mount option
This commit is contained in:
parent
4a046e4de7
commit
f32142f6f5
|
@ -30,6 +30,7 @@ type MountOptions struct {
|
||||||
debug *bool
|
debug *bool
|
||||||
debugPort *int
|
debugPort *int
|
||||||
localSocket *string
|
localSocket *string
|
||||||
|
disableXAttr *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -65,6 +66,7 @@ func init() {
|
||||||
mountOptions.debug = cmdMount.Flag.Bool("debug", false, "serves runtime profiling data, e.g., http://localhost:<debug.port>/debug/pprof/goroutine?debug=2")
|
mountOptions.debug = cmdMount.Flag.Bool("debug", false, "serves runtime profiling data, e.g., http://localhost:<debug.port>/debug/pprof/goroutine?debug=2")
|
||||||
mountOptions.debugPort = cmdMount.Flag.Int("debug.port", 6061, "http port for debugging")
|
mountOptions.debugPort = cmdMount.Flag.Int("debug.port", 6061, "http port for debugging")
|
||||||
mountOptions.localSocket = cmdMount.Flag.String("localSocket", "", "default to /tmp/seaweedfs-mount-<mount_dir_hash>.sock")
|
mountOptions.localSocket = cmdMount.Flag.String("localSocket", "", "default to /tmp/seaweedfs-mount-<mount_dir_hash>.sock")
|
||||||
|
mountOptions.disableXAttr = cmdMount.Flag.Bool("disableXAttr", false, "disable xattr")
|
||||||
|
|
||||||
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||||
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
|
||||||
|
|
|
@ -175,7 +175,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||||
FsName: serverFriendlyName + ":" + filerMountRootPath,
|
FsName: serverFriendlyName + ":" + filerMountRootPath,
|
||||||
Name: "seaweedfs",
|
Name: "seaweedfs",
|
||||||
SingleThreaded: false,
|
SingleThreaded: false,
|
||||||
DisableXAttrs: false,
|
DisableXAttrs: *option.disableXAttr,
|
||||||
Debug: *option.debug,
|
Debug: *option.debug,
|
||||||
EnableLocks: false,
|
EnableLocks: false,
|
||||||
ExplicitDataCacheControl: false,
|
ExplicitDataCacheControl: false,
|
||||||
|
@ -238,6 +238,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
||||||
VolumeServerAccess: *mountOptions.volumeServerAccess,
|
VolumeServerAccess: *mountOptions.volumeServerAccess,
|
||||||
Cipher: cipher,
|
Cipher: cipher,
|
||||||
UidGidMapper: uidGidMapper,
|
UidGidMapper: uidGidMapper,
|
||||||
|
DisableXAttr: *option.disableXAttr,
|
||||||
})
|
})
|
||||||
|
|
||||||
server, err := fuse.NewServer(seaweedFileSystem, dir, fuseMountOptions)
|
server, err := fuse.NewServer(seaweedFileSystem, dir, fuseMountOptions)
|
||||||
|
|
|
@ -40,6 +40,7 @@ type Option struct {
|
||||||
DataCenter string
|
DataCenter string
|
||||||
Umask os.FileMode
|
Umask os.FileMode
|
||||||
Quota int64
|
Quota int64
|
||||||
|
DisableXAttr bool
|
||||||
|
|
||||||
MountUid uint32
|
MountUid uint32
|
||||||
MountGid uint32
|
MountGid uint32
|
||||||
|
|
|
@ -20,6 +20,10 @@ const (
|
||||||
// with the required buffer size.
|
// with the required buffer size.
|
||||||
func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status) {
|
func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string, dest []byte) (size uint32, code fuse.Status) {
|
||||||
|
|
||||||
|
if wfs.option.DisableXAttr {
|
||||||
|
return 0, fuse.Status(syscall.ENOTSUP)
|
||||||
|
}
|
||||||
|
|
||||||
//validate attr name
|
//validate attr name
|
||||||
if len(attr) > MAX_XATTR_NAME_SIZE {
|
if len(attr) > MAX_XATTR_NAME_SIZE {
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
|
@ -70,6 +74,10 @@ func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr str
|
||||||
// attribute does not already exist.
|
// attribute does not already exist.
|
||||||
func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status {
|
func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr string, data []byte) fuse.Status {
|
||||||
|
|
||||||
|
if wfs.option.DisableXAttr {
|
||||||
|
return fuse.Status(syscall.ENOTSUP)
|
||||||
|
}
|
||||||
|
|
||||||
if wfs.IsOverQuota {
|
if wfs.IsOverQuota {
|
||||||
return fuse.Status(syscall.ENOSPC)
|
return fuse.Status(syscall.ENOSPC)
|
||||||
}
|
}
|
||||||
|
@ -127,6 +135,11 @@ func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr st
|
||||||
// slice, and return the number of bytes. If the buffer is too
|
// slice, and return the number of bytes. If the buffer is too
|
||||||
// small, return ERANGE, with the required buffer size.
|
// small, return ERANGE, with the required buffer size.
|
||||||
func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (n uint32, code fuse.Status) {
|
func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []byte) (n uint32, code fuse.Status) {
|
||||||
|
|
||||||
|
if wfs.option.DisableXAttr {
|
||||||
|
return 0, fuse.Status(syscall.ENOTSUP)
|
||||||
|
}
|
||||||
|
|
||||||
_, _, entry, status := wfs.maybeReadEntry(header.NodeId)
|
_, _, entry, status := wfs.maybeReadEntry(header.NodeId)
|
||||||
if status != fuse.OK {
|
if status != fuse.OK {
|
||||||
return 0, status
|
return 0, status
|
||||||
|
@ -156,6 +169,11 @@ func (wfs *WFS) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, dest []
|
||||||
|
|
||||||
// RemoveXAttr removes an extended attribute.
|
// RemoveXAttr removes an extended attribute.
|
||||||
func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string) fuse.Status {
|
func (wfs *WFS) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr string) fuse.Status {
|
||||||
|
|
||||||
|
if wfs.option.DisableXAttr {
|
||||||
|
return fuse.Status(syscall.ENOTSUP)
|
||||||
|
}
|
||||||
|
|
||||||
if len(attr) == 0 {
|
if len(attr) == 0 {
|
||||||
return fuse.EINVAL
|
return fuse.EINVAL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue