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/filehandle.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/filehandle.go')
| -rw-r--r-- | weed/filesys/filehandle.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 6d72e62ce..4419888c4 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -154,6 +154,10 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) { // Write to the file handle func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) error { + if fh.f.wfs.option.ReadOnly { + return fuse.EPERM + } + fh.Lock() defer fh.Unlock() |
