go-ceph: add warn logs to finalizers.

Signed-off-by: Sven Anderson <sven@redhat.com>
This commit is contained in:
Sven Anderson 2022-07-19 00:25:40 +09:00 committed by mergify[bot]
parent f5d1adf26f
commit fdd9853f0f
3 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import "C"
import (
"runtime"
"unsafe"
"github.com/ceph/go-ceph/internal/log"
)
// UserPerm types may be used to get or change the credentials used by the
@ -68,5 +70,8 @@ func (p *UserPerm) Destroy() {
}
func destroyUserPerm(p *UserPerm) {
if p.userPerm != nil && p.managed {
log.Warnf("unreachable UserPerm object has not been destroyed. Cleaning up.")
}
p.Destroy()
}

View File

@ -7,6 +7,8 @@ import (
"fmt"
"strings"
"unsafe"
"github.com/ceph/go-ceph/internal/log"
)
// The file operation.go exists to support both read op and write op types that
@ -116,6 +118,7 @@ func (o *operation) update(kind opKind, ret C.int) error {
func opStepFinalizer(s opStep) {
if s != nil {
log.Warnf("unreachable opStep object found. Cleaning up.")
s.free()
}
}

View File

@ -9,6 +9,8 @@ import "C"
import (
"runtime"
"unsafe"
"github.com/ceph/go-ceph/internal/log"
)
const (
@ -120,6 +122,7 @@ func NewConnWithClusterAndUser(clusterName string, userName string) (*Conn, erro
// called.
func freeConn(conn *Conn) {
if conn.cluster != nil {
log.Warnf("unreachable Conn object has not been shut down. Cleaning up.")
C.rados_shutdown(conn.cluster)
// prevent calling rados_shutdown() more than once
conn.cluster = nil