aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/weedfs_file_copy_range.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/mount/weedfs_file_copy_range.go')
-rw-r--r--weed/mount/weedfs_file_copy_range.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/weed/mount/weedfs_file_copy_range.go b/weed/mount/weedfs_file_copy_range.go
index 49bab17f3..50a2d5a95 100644
--- a/weed/mount/weedfs_file_copy_range.go
+++ b/weed/mount/weedfs_file_copy_range.go
@@ -1,6 +1,7 @@
package mount
import (
+ "github.com/seaweedfs/seaweedfs/weed/util"
"net/http"
"time"
@@ -44,16 +45,16 @@ func (wfs *WFS) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRangeIn)
}
// lock source and target file handles
- fhOut.Lock()
- defer fhOut.Unlock()
+ fhOutActiveLock := fhOut.wfs.fhLockTable.AcquireLock("CopyFileRange", fhOut.fh, util.ExclusiveLock)
+ defer fhOut.wfs.fhLockTable.ReleaseLock(fhOut.fh, fhOutActiveLock)
if fhOut.entry == nil {
return 0, fuse.ENOENT
}
if fhIn.fh != fhOut.fh {
- fhIn.RLock()
- defer fhIn.RUnlock()
+ fhInActiveLock := fhIn.wfs.fhLockTable.AcquireLock("CopyFileRange", fhIn.fh, util.ExclusiveLock)
+ defer fhIn.wfs.fhLockTable.ReleaseLock(fhIn.fh, fhInActiveLock)
}
// directories are not supported