From 44d454648067d21e0c474f397ff5fa675bc30f4b Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 21 Oct 2022 14:16:56 +0200 Subject: [PATCH] cephfs: return abnormal in NodeGetVolumeStats When we do stat on the targetpath, if there is any error we can check is it due to corruption. If yes, cephcsi can return abnormal in the NodeGetVolumeStats so that consumer (CO/admin) and detect and take further action. Signed-off-by: Madhu Rajanna --- internal/cephfs/nodeserver.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/cephfs/nodeserver.go b/internal/cephfs/nodeserver.go index 629467d67..7d7e536d5 100644 --- a/internal/cephfs/nodeserver.go +++ b/internal/cephfs/nodeserver.go @@ -633,6 +633,17 @@ func (ns *NodeServer) NodeGetVolumeStats( stat, err := os.Stat(targetPath) if err != nil { + if util.IsCorruptedMountError(err) { + log.WarningLog(ctx, "corrupted mount detected in %q: %v", targetPath, err) + + return &csi.NodeGetVolumeStatsResponse{ + VolumeCondition: &csi.VolumeCondition{ + Abnormal: true, + Message: err.Error(), + }, + }, nil + } + return nil, status.Errorf(codes.InvalidArgument, "failed to get stat for targetpath %q: %v", targetPath, err) }