diff options
| author | chrislu <chris.lu@gmail.com> | 2023-09-21 11:08:26 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-09-21 11:08:26 -0700 |
| commit | 31fc1657151eb7bb0f45c0657deabe664526a0eb (patch) | |
| tree | 60d5ad8a1ad50506d2550163c02b9151117099db /weed/mount/weedfs_file_copy_range.go | |
| parent | 76698522419902303117d3f736a619b8c01c60f4 (diff) | |
| download | seaweedfs-31fc1657151eb7bb0f45c0657deabe664526a0eb.tar.xz seaweedfs-31fc1657151eb7bb0f45c0657deabe664526a0eb.zip | |
mount switch to ordered lock requests
Diffstat (limited to 'weed/mount/weedfs_file_copy_range.go')
| -rw-r--r-- | weed/mount/weedfs_file_copy_range.go | 9 |
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 |
