Skip to content

Commit

Permalink
cephfs: handle cephfs clone limit error
Browse files Browse the repository at this point in the history
This is to pre-emptively add check for EAGAIN error returned from
ceph as part of ceph/ceph#52670 if all the
clone threads are busy and return csi compatible error.

Fixes: #3996
Signed-off-by: karthik-us <ksubrahm@redhat.com>
  • Loading branch information
karthik-us authored and mergify[bot] committed Nov 24, 2023
1 parent 878eef8 commit f666529
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/cephfs/controllerserver.go
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"syscall"

"github.com/ceph/ceph-csi/internal/cephfs/core"
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
Expand Down Expand Up @@ -134,6 +135,11 @@ func (cs *ControllerServer) createBackingVolumeFromSnapshotSource(
})
if err != nil {
log.ErrorLog(ctx, "failed to create clone from snapshot %s: %v", sID.FsSnapshotName, err)
// TODO: Add error handle for EAGAIN in go-ceph and replace the
// syscall.EAGAIN check with the go-ceph compatible error.
if errors.Is(err, syscall.EAGAIN) {
return status.Error(codes.ResourceExhausted, err.Error())
}

return err
}
Expand All @@ -156,6 +162,11 @@ func (cs *ControllerServer) createBackingVolumeFromVolumeSource(

if err := volClient.CreateCloneFromSubvolume(ctx, &parentVolOpt.SubVolume); err != nil {
log.ErrorLog(ctx, "failed to create clone from subvolume %s: %v", fsutil.VolumeID(pvID.FsSubvolName), err)
// TODO: Add error handle for EAGAIN in go-ceph and replace the
// syscall.EAGAIN check with the go-ceph compatible error.
if errors.Is(err, syscall.EAGAIN) {
return status.Error(codes.ResourceExhausted, err.Error())
}

return err
}
Expand Down

0 comments on commit f666529

Please sign in to comment.