diff options
| author | Chris Lu <chris.lu@uber.com> | 2021-04-04 21:40:58 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2021-04-04 21:40:58 -0700 |
| commit | 0f64f5b9c8bea153171c8070f423b9910820bbb1 (patch) | |
| tree | f647a537329d858e355572a3282a516dac6ce986 /weed/filesys/dir_link.go | |
| parent | 6eee200c13b98088ebc6bb540b78fc7fe136a401 (diff) | |
| download | seaweedfs-0f64f5b9c8bea153171c8070f423b9910820bbb1.tar.xz seaweedfs-0f64f5b9c8bea153171c8070f423b9910820bbb1.zip | |
mount: add readOnly option
fix https://github.com/chrislusf/seaweedfs/issues/1961
Diffstat (limited to 'weed/filesys/dir_link.go')
| -rw-r--r-- | weed/filesys/dir_link.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/filesys/dir_link.go b/weed/filesys/dir_link.go index 606e52fcb..6266e492d 100644 --- a/weed/filesys/dir_link.go +++ b/weed/filesys/dir_link.go @@ -24,6 +24,10 @@ const ( func (dir *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (fs.Node, error) { + if dir.wfs.option.ReadOnly { + return nil, fuse.EPERM + } + oldFile, ok := old.(*File) if !ok { glog.Errorf("old node is not a file: %+v", old) @@ -105,6 +109,10 @@ func (dir *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fs.Node) (f func (dir *Dir) Symlink(ctx context.Context, req *fuse.SymlinkRequest) (fs.Node, error) { + if dir.wfs.option.ReadOnly { + return nil, fuse.EPERM + } + glog.V(4).Infof("Symlink: %v/%v to %v", dir.FullPath(), req.NewName, req.Target) request := &filer_pb.CreateEntryRequest{ |
