@@ -231,15 +231,15 @@ func (opMgr *operationMetricsManager) RecordMetrics(opKey OperationKey, opStatus
231231		obj , exists  :=  opMgr .cache [createKey ]
232232		if  exists  {
233233			// record a cancel metric if found 
234- 			opMgr .recordCancelMetric (obj , createKey , operationDuration )
234+ 			opMgr .recordCancelMetricLocked (obj , createKey , operationDuration )
235235		}
236236
237237		// check if we have a CreateSnapshotAndReady operation pending for this 
238238		createAndReadyKey  :=  NewOperationKey (CreateSnapshotAndReadyOperationName , opKey .ResourceID )
239239		obj , exists  =  opMgr .cache [createAndReadyKey ]
240240		if  exists  {
241241			// record a cancel metric if found 
242- 			opMgr .recordCancelMetric (obj , createAndReadyKey , operationDuration )
242+ 			opMgr .recordCancelMetricLocked (obj , createAndReadyKey , operationDuration )
243243		}
244244	}
245245
@@ -248,9 +248,8 @@ func (opMgr *operationMetricsManager) RecordMetrics(opKey OperationKey, opStatus
248248}
249249
250250// recordCancelMetric records a metric for a create operation that hasn't finished 
251- func  (opMgr  * operationMetricsManager ) recordCancelMetric (val  OperationValue , key  OperationKey , duration  float64 ) {
252- 	opMgr .mu .Lock ()
253- 	defer  opMgr .mu .Unlock ()
251+ // This function must be called with opMgr mutex locked (to prevent recursive locks). 
252+ func  (opMgr  * operationMetricsManager ) recordCancelMetricLocked (val  OperationValue , key  OperationKey , duration  float64 ) {
254253	// record a cancel metric if found 
255254
256255	opMgr .opLatencyMetrics .WithLabelValues (
0 commit comments