|
@ -3,12 +3,20 @@ package mount |
|
|
import ( |
|
|
import ( |
|
|
"github.com/hanwen/go-fuse/v2/fuse" |
|
|
"github.com/hanwen/go-fuse/v2/fuse" |
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" |
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" |
|
|
|
|
|
"time" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
func (wfs *WFS) AcquireHandle(inode uint64, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) { |
|
|
|
|
|
|
|
|
func (wfs *WFS) AcquireHandle(inode uint64, flags, uid, gid uint32) (fileHandle *FileHandle, status fuse.Status) { |
|
|
var entry *filer_pb.Entry |
|
|
var entry *filer_pb.Entry |
|
|
_, _, entry, status = wfs.maybeReadEntry(inode) |
|
|
_, _, entry, status = wfs.maybeReadEntry(inode) |
|
|
if status == fuse.OK { |
|
|
if status == fuse.OK { |
|
|
|
|
|
if entry != nil && wfs.option.WriteOnceReadMany { |
|
|
|
|
|
if entry.Attributes.Mtime+10 < time.Now().Unix() { |
|
|
|
|
|
if flags&fuse.O_ANYWRITE != 0 { |
|
|
|
|
|
return nil, fuse.EPERM |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// need to AcquireFileHandle again to ensure correct handle counter
|
|
|
// need to AcquireFileHandle again to ensure correct handle counter
|
|
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry) |
|
|
fileHandle = wfs.fhmap.AcquireFileHandle(wfs, inode, entry) |
|
|
} |
|
|
} |
|
|