Skip to content

Commit ffca907

Browse files
committed
do not delete mlock files after update
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
1 parent fc2a742 commit ffca907

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: Do not delete mlock files
2+
3+
To prevent stale NFS file handles we no longer delete empty mlock files after updating the metadata.
4+
5+
https://github.com/cs3org/reva/pull/4936
6+
https://github.com/cs3org/reva/pull/4924

pkg/storage/utils/decomposedfs/upload/store.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ import (
3131
"time"
3232

3333
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
34+
"github.com/google/uuid"
35+
"github.com/pkg/errors"
36+
"github.com/rogpeppe/go-internal/lockedfile"
37+
tusd "github.com/tus/tusd/v2/pkg/handler"
38+
3439
"github.com/cs3org/reva/v2/pkg/appctx"
3540
"github.com/cs3org/reva/v2/pkg/errtypes"
3641
"github.com/cs3org/reva/v2/pkg/events"
@@ -41,10 +46,6 @@ import (
4146
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
4247
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options"
4348
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/usermapper"
44-
"github.com/google/uuid"
45-
"github.com/pkg/errors"
46-
"github.com/rogpeppe/go-internal/lockedfile"
47-
tusd "github.com/tus/tusd/v2/pkg/handler"
4849
)
4950

5051
var _idRegexp = regexp.MustCompile(".*/([^/]+).info")
@@ -312,11 +313,8 @@ func (store OcisStore) updateExistingNode(ctx context.Context, session *OcisSess
312313
}
313314

314315
unlock := func() error {
315-
err := f.Close()
316-
if err != nil {
317-
return err
318-
}
319-
return os.Remove(store.lu.MetadataBackend().LockfilePath(targetPath))
316+
// NOTE: to prevent stale NFS file handles do not remove lock file!
317+
return f.Close()
320318
}
321319

322320
old, _ := node.ReadNode(ctx, store.lu, spaceID, n.ID, false, nil, false)

0 commit comments

Comments
 (0)