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: ceph#3996
Signed-off-by: karthik-us <ksubrahm@redhat.com>
  • Loading branch information
karthik-us committed Nov 23, 2023
1 parent 5e80c6a commit 441638f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/cephfs/controllerserver.go
Original file line number Diff line number Diff line change
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 441638f

Please sign in to comment.