mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-24 05:28:38 +08:00
FUSE: skip flushing if file is deleted
related to https://github.com/chrislusf/seaweedfs/issues/2110
This commit is contained in:
parent
cd59573dd3
commit
055374a50b
@ -443,7 +443,10 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
|||||||
dir.wfs.handlesLock.Lock()
|
dir.wfs.handlesLock.Lock()
|
||||||
defer dir.wfs.handlesLock.Unlock()
|
defer dir.wfs.handlesLock.Unlock()
|
||||||
inodeId := filePath.AsInode()
|
inodeId := filePath.AsInode()
|
||||||
delete(dir.wfs.handles, inodeId)
|
if fh, ok := dir.wfs.handles[inodeId]; ok {
|
||||||
|
delete(dir.wfs.handles, inodeId)
|
||||||
|
fh.isDeleted = true
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
|
@ -33,11 +33,12 @@ type FileHandle struct {
|
|||||||
Uid uint32 // user ID of process making request
|
Uid uint32 // user ID of process making request
|
||||||
Gid uint32 // group ID of process making request
|
Gid uint32 // group ID of process making request
|
||||||
writeOnly bool
|
writeOnly bool
|
||||||
|
isDeleted bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle {
|
func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle {
|
||||||
fh := &FileHandle{
|
fh := &FileHandle{
|
||||||
f: file,
|
f: file,
|
||||||
// dirtyPages: newContinuousDirtyPages(file, writeOnly),
|
// dirtyPages: newContinuousDirtyPages(file, writeOnly),
|
||||||
dirtyPages: newTempFileDirtyPages(file, writeOnly),
|
dirtyPages: newTempFileDirtyPages(file, writeOnly),
|
||||||
Uid: uid,
|
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)
|
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()
|
fh.Lock()
|
||||||
defer fh.Unlock()
|
defer fh.Unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user