Browse Source

mount: quota adjust error type to be syscall.ENOSPC

pull/2731/head
chrislu 3 years ago
parent
commit
f3442e36e6
  1. 2
      weed/mount/weedfs_attr.go
  2. 2
      weed/mount/weedfs_dir_mkrm.go
  3. 3
      weed/mount/weedfs_file_mkrm.go
  4. 3
      weed/mount/weedfs_file_sync.go
  5. 3
      weed/mount/weedfs_file_write.go
  6. 3
      weed/mount/weedfs_link.go
  7. 2
      weed/mount/weedfs_rename.go
  8. 3
      weed/mount/weedfs_symlink.go
  9. 2
      weed/mount/weedfs_xattr.go

2
weed/mount/weedfs_attr.go

@ -36,7 +36,7 @@ func (wfs *WFS) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *fuse
func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse.Status) { func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
path, fh, entry, status := wfs.maybeReadEntry(input.NodeId) path, fh, entry, status := wfs.maybeReadEntry(input.NodeId)

2
weed/mount/weedfs_dir_mkrm.go

@ -22,7 +22,7 @@ import (
func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status) { func (wfs *WFS) Mkdir(cancel <-chan struct{}, in *fuse.MkdirIn, name string, out *fuse.EntryOut) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
if s := checkName(name); s != fuse.OK { if s := checkName(name); s != fuse.OK {

3
weed/mount/weedfs_file_mkrm.go

@ -7,6 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/hanwen/go-fuse/v2/fuse" "github.com/hanwen/go-fuse/v2/fuse"
"syscall"
"time" "time"
) )
@ -36,7 +37,7 @@ func (wfs *WFS) Create(cancel <-chan struct{}, in *fuse.CreateIn, name string, o
func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status) { func (wfs *WFS) Mknod(cancel <-chan struct{}, in *fuse.MknodIn, name string, out *fuse.EntryOut) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
if s := checkName(name); s != fuse.OK { if s := checkName(name); s != fuse.OK {

3
weed/mount/weedfs_file_sync.go

@ -7,6 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/hanwen/go-fuse/v2/fuse" "github.com/hanwen/go-fuse/v2/fuse"
"syscall"
"time" "time"
) )
@ -112,7 +113,7 @@ func (wfs *WFS) doFlush(fh *FileHandle, uid, gid uint32) fuse.Status {
} }
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { err := wfs.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {

3
weed/mount/weedfs_file_write.go

@ -3,6 +3,7 @@ package mount
import ( import (
"github.com/hanwen/go-fuse/v2/fuse" "github.com/hanwen/go-fuse/v2/fuse"
"net/http" "net/http"
"syscall"
) )
/** /**
@ -34,7 +35,7 @@ import (
func (wfs *WFS) Write(cancel <-chan struct{}, in *fuse.WriteIn, data []byte) (written uint32, code fuse.Status) { func (wfs *WFS) Write(cancel <-chan struct{}, in *fuse.WriteIn, data []byte) (written uint32, code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return 0, fuse.EPERM
return 0, fuse.Status(syscall.ENOSPC)
} }
fh := wfs.GetHandle(FileHandleId(in.Fh)) fh := wfs.GetHandle(FileHandleId(in.Fh))

3
weed/mount/weedfs_link.go

@ -6,6 +6,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/hanwen/go-fuse/v2/fuse" "github.com/hanwen/go-fuse/v2/fuse"
"syscall"
"time" "time"
) )
@ -24,7 +25,7 @@ When creating a link:
func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *fuse.EntryOut) (code fuse.Status) { func (wfs *WFS) Link(cancel <-chan struct{}, in *fuse.LinkIn, name string, out *fuse.EntryOut) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
if s := checkName(name); s != fuse.OK { if s := checkName(name); s != fuse.OK {

2
weed/mount/weedfs_rename.go

@ -132,7 +132,7 @@ const (
func (wfs *WFS) Rename(cancel <-chan struct{}, in *fuse.RenameIn, oldName string, newName string) (code fuse.Status) { func (wfs *WFS) Rename(cancel <-chan struct{}, in *fuse.RenameIn, oldName string, newName string) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
if s := checkName(newName); s != fuse.OK { if s := checkName(newName); s != fuse.OK {

3
weed/mount/weedfs_symlink.go

@ -8,6 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/hanwen/go-fuse/v2/fuse" "github.com/hanwen/go-fuse/v2/fuse"
"os" "os"
"syscall"
"time" "time"
) )
@ -15,7 +16,7 @@ import (
func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) (code fuse.Status) { func (wfs *WFS) Symlink(cancel <-chan struct{}, header *fuse.InHeader, target string, name string, out *fuse.EntryOut) (code fuse.Status) {
if wfs.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
if s := checkName(name); s != fuse.OK { if s := checkName(name); s != fuse.OK {
return s return s

2
weed/mount/weedfs_xattr.go

@ -71,7 +71,7 @@ func (wfs *WFS) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr str
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.IsOverQuota { if wfs.IsOverQuota {
return fuse.EPERM
return fuse.Status(syscall.ENOSPC)
} }
//validate attr name //validate attr name

Loading…
Cancel
Save