mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
util: use ClusterConnection.Copy() for re-using connections
Connections are reference counted, so just assigning the connection to an other object for re-use is not correct. This can cause connections to be garbage collected while something else is still using it. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
6e941539b5
commit
5c26fbb0d7
@ -127,7 +127,7 @@ func (rv *rbdVolume) checkCloneImage(ctx context.Context, parentVol *rbdVolume)
|
||||
|
||||
func (rv *rbdVolume) generateTempClone() *rbdVolume {
|
||||
tempClone := rbdVolume{}
|
||||
tempClone.conn = rv.conn
|
||||
tempClone.conn = rv.conn.Copy()
|
||||
// The temp clone image need to have deep flatten feature
|
||||
f := []string{librbd.FeatureNameLayering, librbd.FeatureNameDeepFlatten}
|
||||
tempClone.imageFeatureSet = librbd.FeatureSetFromNames(f)
|
||||
|
@ -496,7 +496,7 @@ func (rv *rbdVolume) getCloneDepth(ctx context.Context) (uint, error) {
|
||||
vol.Pool = rv.Pool
|
||||
vol.Monitors = rv.Monitors
|
||||
vol.RbdImageName = rv.RbdImageName
|
||||
vol.conn = rv.conn
|
||||
vol.conn = rv.conn.Copy()
|
||||
|
||||
err := vol.openIoctx()
|
||||
if err != nil {
|
||||
@ -666,7 +666,7 @@ func (rv *rbdVolume) checkImageChainHasFeature(ctx context.Context, feature uint
|
||||
vol.RadosNamespace = rv.RadosNamespace
|
||||
vol.Monitors = rv.Monitors
|
||||
vol.RbdImageName = rv.RbdImageName
|
||||
vol.conn = rv.conn
|
||||
vol.conn = rv.conn.Copy()
|
||||
|
||||
err := vol.openIoctx()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user