From patchwork Wed Aug 2 20:10:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9877525 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 CF3E160360 for ; Wed, 2 Aug 2017 20:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0F5C286BB for ; Wed, 2 Aug 2017 20:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B532C287FF; Wed, 2 Aug 2017 20:16:00 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 675C7286BB for ; Wed, 2 Aug 2017 20:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753384AbdHBUOY (ORCPT ); Wed, 2 Aug 2017 16:14:24 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:37000 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753029AbdHBUM0 (ORCPT ); Wed, 2 Aug 2017 16:12:26 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id czzJd530p3vhKczzJdxf3m; Wed, 02 Aug 2017 13:11:25 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv.com with local (Exim 4.89) (envelope-from ) id 1dczzJ-0005IV-Nt; Wed, 02 Aug 2017 13:11:25 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Cc: Long Li Subject: [[PATCH v1] 29/37] [CIFS] SMBD: Disconnect RDMA connection on QP errors Date: Wed, 2 Aug 2017 13:10:40 -0700 Message-Id: <1501704648-20159-30-git-send-email-longli@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> X-CMAE-Envelope: MS4wfA9N3MVBsZl+UBAuku3tCjA+6Py/zudTvgWW8HiwUdS9iHnsGJflZNIv9ofL/lXkhDMYjm3W6yJIY00pxHYXhzRad6vvS5sAjYbMBMHxpc/D87Zs07ME VLI++9ENrsB9+xh5t4aTFChouwea/H0qfcV3kZph3qCFdhA3GlyFxyoo19P9jqV75Dtqa2TJ6ILaBaEovJw4IVzT0dSuIVIfzCCSsDJcdBdpTQQFL8a/wUdN 8JYdYFHJD7qJ80yJ01kDU8w71bBiiSFy9zHqnFqXpTNDbH/rS4+d7x0OfzppdugunPBPSITMZhg6z9e+2mZO0Ml6nDERnejQq3vbOY3x4oU= Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li Sometime Queue Pair may have errors if hardware is having trouble with connectivity issues. In this case, SMBD should terminate the RDMA connetion. Signed-off-by: Long Li --- fs/cifs/cifsrdma.c | 18 ++++++++++++++++++ fs/cifs/cifsrdma.h | 1 + 2 files changed, 19 insertions(+) diff --git a/fs/cifs/cifsrdma.c b/fs/cifs/cifsrdma.c index fb94975..01cb006 100644 --- a/fs/cifs/cifsrdma.c +++ b/fs/cifs/cifsrdma.c @@ -202,6 +202,22 @@ static int cifs_rdma_process_disconnected(struct cifs_rdma_info *info) return 0; } +static void cifs_disconnect_rdma_work(struct work_struct *work) +{ + struct cifs_rdma_info *info = + container_of(work, struct cifs_rdma_info, disconnect_work); + + if (info->transport_status == CIFS_RDMA_CONNECTED) { + info->transport_status = CIFS_RDMA_DISCONNECTING; + rdma_disconnect(info->id); + } +} + +static void cifs_disconnect_rdma_session(struct cifs_rdma_info *info) +{ + schedule_work(&info->disconnect_work); +} + /* Upcall from RDMA CM */ static int cifs_rdma_conn_upcall( struct rdma_cm_id *id, struct rdma_cm_event *event) @@ -264,6 +280,7 @@ cifs_rdma_qp_async_error_upcall(struct ib_event *event, void *context) case IB_EVENT_QP_FATAL: case IB_EVENT_QP_REQ_ERR: case IB_EVENT_QP_ACCESS_ERR: + cifs_disconnect_rdma_session(info); default: break; @@ -1494,6 +1511,7 @@ struct cifs_rdma_info* cifs_create_rdma_session( init_waitqueue_head(&info->wait_recv_pending); atomic_set(&info->recv_pending, 0); + INIT_WORK(&info->disconnect_work, cifs_disconnect_rdma_work); INIT_WORK(&info->destroy_work, cifs_destroy_rdma_work); rc = cifs_rdma_negotiate(info); diff --git a/fs/cifs/cifsrdma.h b/fs/cifs/cifsrdma.h index 424ea8e..9306622 100644 --- a/fs/cifs/cifsrdma.h +++ b/fs/cifs/cifsrdma.h @@ -68,6 +68,7 @@ struct cifs_rdma_info { bool negotiate_done; struct work_struct destroy_work; + struct work_struct disconnect_work; //connection paramters int receive_credit_max;