Blob Blame History Raw
From 6d6467b88c009e228aece154b5d7550703125a62 Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Fri, 10 Jun 2016 19:30:08 +0200
Subject: [PATCH 1/2] target/rbd: don't put snap_context twice
Patch-mainline: Not yet, SES clustered LIO/RBD
References: bsc#981143

Complimentary to the 70b16db86f564977df074072143284aec2cb1162 fix from
upstream: rbd_img_request_put() puts the snap_context provided with
rbd_img_request_create(), so do *not* call ceph_put_snap_context() with
the same snap_context in the tcm_rbd_execute_cmp_and_write() and
tcm_rbd_execute_cmd() error paths.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Jan Fajerski <jan.fajerski@suse.com>
---
 drivers/target/target_core_rbd.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/target/target_core_rbd.c
+++ b/drivers/target/target_core_rbd.c
@@ -308,6 +308,7 @@ tcm_rbd_execute_cmd(struct se_cmd *cmd,
 		sense = TCM_OUT_OF_RESOURCES;
 		goto free_snapc;
 	}
+	snapc = NULL; /* img_request consumes a ref */
 
 	ret = rbd_img_request_fill(img_request,
 				   sgl ? OBJ_REQUEST_SG : OBJ_REQUEST_NODATA,
@@ -443,6 +444,7 @@ static sense_reason_t tcm_rbd_execute_cm
 		sense = TCM_OUT_OF_RESOURCES;
 		goto free_snapc;
 	}
+	snapc = NULL; /* img_request consumes a ref */
 
 	ret = down_interruptible(&dev->caw_sem);
 	if (ret != 0) {