From patchwork Tue Oct 25 23:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ismail, Mustafa" X-Patchwork-Id: 9395703 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 E275860234 for ; Tue, 25 Oct 2016 23:36:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3BDA29253 for ; Tue, 25 Oct 2016 23:36:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 980D829640; Tue, 25 Oct 2016 23:36:07 +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 34A3B29253 for ; Tue, 25 Oct 2016 23:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755493AbcJYXgG (ORCPT ); Tue, 25 Oct 2016 19:36:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:6996 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754167AbcJYXgG (ORCPT ); Tue, 25 Oct 2016 19:36:06 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 25 Oct 2016 16:36:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,399,1473145200"; d="scan'208";a="777663970" Received: from mustafai-mobl.amr.corp.intel.com ([10.254.53.40]) by FMSMGA003.fm.intel.com with ESMTP; 25 Oct 2016 16:36:05 -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 v2] Avoid possible hang on device removal Date: Tue, 25 Oct 2016 18:35:57 -0500 Message-Id: <1477438557-15884-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. v1 -> v2: Add Fixes tag Fixes: 612eae1f6fe3 ("rping: ignore flushed completions") Signed-off-by: Mustafa Ismail --- 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;