Browse Source

[mount]Fix copy file range (#4407)

* fix:mount deadlock

* fix

---------

Co-authored-by: zemul <zhouzemiao@ihuman.com>
pull/4423/head
zemul 2 years ago
committed by GitHub
parent
commit
68f1cc34a5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      weed/mount/weedfs_file_copy_range.go

8
weed/mount/weedfs_file_copy_range.go

@ -46,18 +46,14 @@ func (wfs *WFS) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn)
// lock source and target file handles // lock source and target file handles
fhOut.Lock() fhOut.Lock()
defer fhOut.Unlock() defer fhOut.Unlock()
fhOut.entryLock.Lock()
defer fhOut.entryLock.Unlock()
if fhOut.entry == nil { if fhOut.entry == nil {
return 0, fuse.ENOENT return 0, fuse.ENOENT
} }
if fhIn.fh != fhOut.fh { if fhIn.fh != fhOut.fh {
fhIn.Lock()
defer fhIn.Unlock()
fhIn.entryLock.Lock()
defer fhIn.entryLock.Unlock()
fhIn.RLock()
defer fhIn.RUnlock()
} }
// directories are not supported // directories are not supported

Loading…
Cancel
Save