From 83bcd693b084b044a988fffc9fa63edd856c9f10 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 11 Dec 2019 19:40:36 -0500 Subject: [PATCH] lib/iscsi: Assert if PDU ref count goes negative Error log had been collected if PDU ref count went negative. However, error log is not easy to notice. SPDK iSCSI target is more stable than before and SPDK iSCSI task has such assert. Hence replace error log by assert for PDU. Signed-off-by: Shuhei Matsumoto Change-Id: I28c4f5e29f0dfd72436b0131e09f9707822165fc Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477630 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Changpeng Liu --- lib/iscsi/iscsi_subsystem.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index 4b77dae84..528e48fd3 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -294,13 +294,9 @@ void spdk_put_pdu(struct spdk_iscsi_pdu *pdu) return; } + assert(pdu->ref > 0); pdu->ref--; - if (pdu->ref < 0) { - SPDK_ERRLOG("Negative PDU refcount: %p\n", pdu); - pdu->ref = 0; - } - if (pdu->ref == 0) { if (pdu->mobj) { spdk_mempool_put(pdu->mobj->mp, (void *)pdu->mobj);