From 517bfd515664332a87a4afe626ca4aa84aa7c13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 17 Sep 2020 13:03:46 +0200 Subject: [PATCH] fix ocis props MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/fix-oci-props.md | 6 ++++++ pkg/storage/fs/ocis/metadata.go | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/fix-oci-props.md diff --git a/changelog/unreleased/fix-oci-props.md b/changelog/unreleased/fix-oci-props.md new file mode 100644 index 0000000000..e931d78af1 --- /dev/null +++ b/changelog/unreleased/fix-oci-props.md @@ -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 \ No newline at end of file diff --git a/pkg/storage/fs/ocis/metadata.go b/pkg/storage/fs/ocis/metadata.go index e8f94beb52..88b0d7ed58 100644 --- a/pkg/storage/fs/ocis/metadata.go +++ b/pkg/storage/fs/ocis/metadata.go @@ -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" @@ -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