Skip to content

Commit

Permalink
do not delete mlock files after update
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Nov 14, 2024
1 parent fc2a742 commit ffca907
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/no-delete-lock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Do not delete mlock files

To prevent stale NFS file handles we no longer delete empty mlock files after updating the metadata.

https://github.com/cs3org/reva/pull/4936
https://github.com/cs3org/reva/pull/4924
16 changes: 7 additions & 9 deletions pkg/storage/utils/decomposedfs/upload/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ import (
"time"

provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
tusd "github.com/tus/tusd/v2/pkg/handler"

"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/events"
Expand All @@ -41,10 +46,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options"
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/usermapper"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/rogpeppe/go-internal/lockedfile"
tusd "github.com/tus/tusd/v2/pkg/handler"
)

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

unlock := func() error {
err := f.Close()
if err != nil {
return err
}
return os.Remove(store.lu.MetadataBackend().LockfilePath(targetPath))
// NOTE: to prevent stale NFS file handles do not remove lock file!
return f.Close()
}

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

0 comments on commit ffca907

Please sign in to comment.