diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-06-15 12:45:20 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-06-15 12:45:23 -0700 |
| commit | 055374a50bc3cfe78be6d73514182decb8531666 (patch) | |
| tree | c8a8e3d89f8aeab739816c897e4cda452c6fe0d7 /weed/filesys/filehandle.go | |
| parent | cd59573dd3cdb797783091bae1c6d4464e3c423c (diff) | |
| download | seaweedfs-055374a50bc3cfe78be6d73514182decb8531666.tar.xz seaweedfs-055374a50bc3cfe78be6d73514182decb8531666.zip | |
FUSE: skip flushing if file is deleted
related to https://github.com/chrislusf/seaweedfs/issues/2110
Diffstat (limited to 'weed/filesys/filehandle.go')
| -rw-r--r-- | weed/filesys/filehandle.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 88cfe45f0..f95051f65 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -33,11 +33,12 @@ type FileHandle struct { Uid uint32 // user ID of process making request Gid uint32 // group ID of process making request writeOnly bool + isDeleted bool } func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle { fh := &FileHandle{ - f: file, + f: file, // dirtyPages: newContinuousDirtyPages(file, writeOnly), dirtyPages: newTempFileDirtyPages(file, writeOnly), Uid: uid, @@ -222,6 +223,11 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error { glog.V(4).Infof("Flush %v fh %d", fh.f.fullpath(), fh.handle) + if fh.isDeleted { + glog.V(4).Infof("Flush %v fh %d skip deleted", fh.f.fullpath(), fh.handle) + return nil + } + fh.Lock() defer fh.Unlock() |
