From 454bcc466a536d637eeb7e07cf22a66ec557b35e Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 11 Oct 2022 13:52:26 +0200 Subject: [PATCH] cephfs: use errors.As instead of errors.Is As we need to compare the error type instead of the error value we need to use errors.As to check the API is implemented or not. fixes: #3347 Signed-off-by: Madhu Rajanna (cherry picked from commit b40e8894f8eead7f86883de4078f15936d1c378e) --- internal/cephfs/core/metadata.go | 2 +- internal/cephfs/core/snapshot_metadata.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cephfs/core/metadata.go b/internal/cephfs/core/metadata.go index d5fb8a73a..9e2b90d5f 100644 --- a/internal/cephfs/core/metadata.go +++ b/internal/cephfs/core/metadata.go @@ -40,7 +40,7 @@ func (s *subVolumeClient) supportsSubVolMetadata() bool { func (s *subVolumeClient) isUnsupportedSubVolMetadata(err error) bool { var invalid fsAdmin.NotImplementedError - if err != nil && errors.Is(err, &invalid) { + if err != nil && errors.As(err, &invalid) { // In case the error is other than invalid command return error to the caller. clusterAdditionalInfo[s.clusterID].subVolMetadataState = unsupported diff --git a/internal/cephfs/core/snapshot_metadata.go b/internal/cephfs/core/snapshot_metadata.go index 5cf67ddc0..f168fbf8c 100644 --- a/internal/cephfs/core/snapshot_metadata.go +++ b/internal/cephfs/core/snapshot_metadata.go @@ -36,7 +36,7 @@ func (s *snapshotClient) supportsSubVolSnapMetadata() bool { func (s *snapshotClient) isUnsupportedSubVolSnapMetadata(err error) bool { var invalid fsAdmin.NotImplementedError - if err != nil && errors.Is(err, &invalid) { + if err != nil && errors.As(err, &invalid) { // In case the error is other than invalid command return error to // the caller. clusterAdditionalInfo[s.clusterID].subVolSnapshotMetadataState = unsupported