From patchwork Fri Dec 3 23:33:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arlin Davis X-Patchwork-Id: 379291 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB3NXFvs012237 for ; Fri, 3 Dec 2010 23:33:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753882Ab0LCXdQ (ORCPT ); Fri, 3 Dec 2010 18:33:16 -0500 Received: from mga01.intel.com ([192.55.52.88]:26206 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753748Ab0LCXdQ convert rfc822-to-8bit (ORCPT ); Fri, 3 Dec 2010 18:33:16 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 03 Dec 2010 15:33:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,296,1288594800"; d="scan'208";a="864263071" Received: from orsmsx602.amr.corp.intel.com ([10.22.226.211]) by fmsmga001.fm.intel.com with ESMTP; 03 Dec 2010 15:33:11 -0800 Received: from orsmsx506.amr.corp.intel.com ([10.22.226.44]) by orsmsx602.amr.corp.intel.com ([10.22.226.211]) with mapi; Fri, 3 Dec 2010 15:33:11 -0800 From: "Davis, Arlin R" To: linux-rdma , "ofw@lists.openfabrics.org" CC: "Smith, Stan" Date: Fri, 3 Dec 2010 15:33:04 -0800 Subject: [PATCH] DAPL v2.0: cma: disconnect can block for excessive times waiting for rdma_cm DREP timeout Thread-Topic: [PATCH] DAPL v2.0: cma: disconnect can block for excessive times waiting for rdma_cm DREP timeout Thread-Index: ActyJdB1zpL8wMt1SpGrifvPhTdQ9QhG2UBwAAAWHLA= Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-cr-hashedpuzzle: BE3X DBco E78X HEGW HNO6 Kr18 K800 LAZs LFvq PEo2 PjKO QocF Rfob TImH Tpz8 XJ3l; 2; bABpAG4AdQB4AC0AcgBkAG0AYQBAAHYAZwBlAHIALgBrAGUAcgBuAGUAbAAuAG8AcgBnADsAbwBmAHcAQABsAGkAcwB0AHMALgBvAHAAZQBuAGYAYQBiAHIAaQBjAHMALgBvAHIAZwA=; Sosha1_v1; 7; {8A8269ED-9078-43B1-BC03-C9E4C0639AEA}; YQByAGwAaQBuAC4AcgAuAGQAYQB2AGkAcwBAAGkAbgB0AGUAbAAuAGMAbwBtAA==; Fri, 03 Dec 2010 23:33:04 GMT; WwBQAEEAVABDAEgAXQAgAEQAQQBQAEwAIAB2ADIALgAwADoAIABjAG0AYQA6ACAAZABpAHMAYwBvAG4AbgBlAGMAdAAgAGMAYQBuACAAYgBsAG8AYwBrACAAZgBvAHIAIABlAHgAYwBlAHMAcwBpAHYAZQAgAHQAaQBtAGUAcwAgAHcAYQBpAHQAaQBuAGcAIABmAG8AcgAgAHIAZABtAGEAXwBjAG0AIABEAFIARQBQACAAdABpAG0AZQBvAHUAdAA= x-cr-puzzleid: {8A8269ED-9078-43B1-BC03-C9E4C0639AEA} acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Dec 2010 23:33:17 +0000 (UTC) diff --git a/dapl/openib_cma/cm.c b/dapl/openib_cma/cm.c index 1eb7aed..ff48999 100644 --- a/dapl/openib_cma/cm.c +++ b/dapl/openib_cma/cm.c @@ -623,6 +623,7 @@ DAT_RETURN dapls_ib_disconnect(IN DAPL_EP * ep_ptr, IN DAT_CLOSE_FLAGS close_flags) { struct dapl_cm_id *conn = dapl_get_cm_from_ep(ep_ptr); + int drep_time = 25; dapl_dbg_log(DAPL_DBG_TYPE_CM, " disconnect(ep %p, conn %p, id %d flags %x)\n", @@ -636,13 +637,29 @@ dapls_ib_disconnect(IN DAPL_EP * ep_ptr, IN DAT_CLOSE_FLAGS close_flags) /* ABRUPT close, wait for callback and DISCONNECTED state */ if (close_flags == DAT_CLOSE_ABRUPT_FLAG) { + DAPL_EVD *evd = NULL; + DAT_EVENT_NUMBER num = DAT_CONNECTION_EVENT_DISCONNECTED; + dapl_os_lock(&ep_ptr->header.lock); - while (ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED) { + /* limit DREP waiting, other side could be down */ + while (--drep_time && ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED) { dapl_os_unlock(&ep_ptr->header.lock); dapl_os_sleep_usec(10000); dapl_os_lock(&ep_ptr->header.lock); } + if (ep_ptr->param.ep_state != DAT_EP_STATE_DISCONNECTED) { + dapl_log(DAPL_DBG_TYPE_WARN, + " WARNING: disconnect(ep %p, conn %p, id %d) timed out\n", + ep_ptr, conn, (conn ? conn->cm_id : 0)); + ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED; + evd = (DAPL_EVD *)ep_ptr->param.connect_evd_handle; + } dapl_os_unlock(&ep_ptr->header.lock); + + if (evd) { + dapl_sp_remove_ep(ep_ptr); + dapls_evd_post_connection_event(evd, num, ep_ptr, 0, 0); + } } /*