config/packages/tools/brig/repin-relaxed-locking.patch

41 lines
1.1 KiB
Diff

diff --git a/catfs/repin.go b/catfs/repin.go
index 63ba711e..f8b5b9d6 100644
--- a/catfs/repin.go
+++ b/catfs/repin.go
@@ -247,9 +247,12 @@ func (fs *FS) repin(root string) error {
savedStorage := uint64(0)
parts := []*partition{}
+ fs.mu.Unlock()
log.Infof("repin started (min=%d max=%d quota=%s)", minDepth, maxDepth, quotaSrc)
err = n.Walk(fs.lkr, rootNd, true, func(child n.Node) error {
+ fs.mu.Lock()
+ defer fs.mu.Unlock()
if child.Type() == n.NodeTypeDirectory {
return nil
}
@@ -259,6 +262,7 @@ func (fs *FS) repin(root string) error {
return e.Wrapf(ie.ErrBadNode, "repin")
}
+ fs.mu.Unlock()
part, err := fs.partitionNodeHashes(modChild, minDepth, maxDepth)
if err != nil {
return err
@@ -273,6 +277,7 @@ func (fs *FS) repin(root string) error {
if err != nil {
return err
}
+ fs.mu.Lock()
totalStorage += part.PinSize
addedToStorage += pinBytes
@@ -286,6 +291,7 @@ func (fs *FS) repin(root string) error {
return e.Wrapf(err, "repin: walk")
}
+ fs.mu.Lock()
quotaUnpins, err := fs.balanceQuota(parts, totalStorage, quota)
if err != nil {
return e.Wrapf(err, "repin: quota balance")