Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix litmus failing on ocis storage #1179

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-oci-props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix litmus failing on ocis storage

We now ignore the `no data available` error when removing a non existing metadata attribute, which is ok because we are trying to delete it anyway.

https://github.com/cs3org/reva/issues/1178
https://github.com/cs3org/reva/pull/1179
12 changes: 11 additions & 1 deletion pkg/storage/fs/ocis/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"path/filepath"

provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/pkg/errors"
"github.com/pkg/xattr"
Expand Down Expand Up @@ -62,7 +63,16 @@ func (fs *ocisfs) UnsetArbitraryMetadata(ctx context.Context, ref *provider.Refe
for i := range keys {
attrName := metadataPrefix + keys[i]
if err = xattr.Remove(nodePath, attrName); err != nil {
return errors.Wrap(err, "ocisfs: could not remove metadata attribute "+attrName)
// a non-existing attribute will return an error, which we can ignore
// (using string compare because the error type is syscall.Errno and not wrapped/recognizable)
if e, ok := err.(*xattr.Error); !ok || e.Err.Error() != "no data available" {
appctx.GetLogger(ctx).Error().Err(err).
Interface("node", n).
Str("key", keys[i]).
Msg("could not unset metadata")
} else {
err = nil
}
}
}
return
Expand Down