From patchwork Tue Oct 25 20:50:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ismail, Mustafa" X-Patchwork-Id: 9395459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 694DB60235 for ; Tue, 25 Oct 2016 20:51:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F46129763 for ; Tue, 25 Oct 2016 20:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 430912976B; Tue, 25 Oct 2016 20:51:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08F902976A for ; Tue, 25 Oct 2016 20:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754161AbcJYUvP (ORCPT ); Tue, 25 Oct 2016 16:51:15 -0400 Received: from mga04.intel.com ([192.55.52.120]:39227 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754104AbcJYUvO (ORCPT ); Tue, 25 Oct 2016 16:51:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP; 25 Oct 2016 13:51:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,399,1473145200"; d="scan'208";a="1059041749" Received: from mustafai-mobl.amr.corp.intel.com ([10.122.32.153]) by fmsmga001.fm.intel.com with ESMTP; 25 Oct 2016 13:51:13 -0700 From: Mustafa Ismail To: linux-rdma@vger.kernel.org, sean.hefty@intel.com, hal@dev.mellanox.co.il Cc: dledford@redhat.com, swise@opengridcomputing.com, leon@kernel.org Subject: [PATCH] Avoid possible hang on device removal Date: Tue, 25 Oct 2016 15:50:28 -0500 Message-Id: <1477428628-11504-1-git-send-email-mustafa.ismail@intel.com> X-Mailer: git-send-email 2.7.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we get an RDMA_CM_EVENT_DEVICE_REMOVAL the cm_thread will exit and because flush errors are ignored the cb->sem may not get signaled. So just signal on device removal event. Signed-off-by: Mustafa Ismail Reviewed-by: Steve Wise --- librdmacm/examples/rping.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librdmacm/examples/rping.c b/librdmacm/examples/rping.c index ad38f6d..53c1525 100644 --- a/librdmacm/examples/rping.c +++ b/librdmacm/examples/rping.c @@ -224,6 +224,8 @@ static int rping_cma_event_handler(struct rdma_cm_id *cma_id, case RDMA_CM_EVENT_DEVICE_REMOVAL: fprintf(stderr, "cma detected device removal!!!!\n"); + cb->state = ERROR; + sem_post(&cb->sem); ret = -1; break;