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 ( import (
"runtime" "runtime"
"unsafe" "unsafe"
"github.com/ceph/go-ceph/internal/log"
) )
// UserPerm types may be used to get or change the credentials used by the // 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) { func destroyUserPerm(p *UserPerm) {
if p.userPerm != nil && p.managed {
log.Warnf("unreachable UserPerm object has not been destroyed. Cleaning up.")
}
p.Destroy() p.Destroy()
} }

View File

@ -7,6 +7,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"unsafe" "unsafe"
"github.com/ceph/go-ceph/internal/log"
) )
// The file operation.go exists to support both read op and write op types that // 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) { func opStepFinalizer(s opStep) {
if s != nil { if s != nil {
log.Warnf("unreachable opStep object found. Cleaning up.")
s.free() s.free()
} }
} }

View File

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