From patchwork Mon Mar 10 15:38:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Derr X-Patchwork-Id: 3804121 X-Patchwork-Delegate: ericvh@gmail.com Return-Path: X-Original-To: patchwork-v9fs-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C4F4C9F370 for ; Mon, 10 Mar 2014 16:11:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBF8C202AE for ; Mon, 10 Mar 2014 16:11:23 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE81C2021E for ; Mon, 10 Mar 2014 16:11:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1WN2nS-0000fO-9H; Mon, 10 Mar 2014 16:11:22 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1WN2nQ-0000fD-QE for v9fs-developer@lists.sourceforge.net; Mon, 10 Mar 2014 16:11:20 +0000 X-ACL-Warn: Received: from ecfrec.frec.bull.fr ([129.183.4.8]) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1WN2nJ-0005CY-Fp for v9fs-developer@lists.sourceforge.net; Mon, 10 Mar 2014 16:11:20 +0000 Received: from atlas.frec.bull.fr (atlas.frec.bull.fr [129.183.91.13]) by ecfrec.frec.bull.fr (Postfix) with ESMTP id 5FF8C6F59F; Mon, 10 Mar 2014 16:39:12 +0100 (CET) Received: from atlas.frec.bull.fr (localhost [127.0.0.1]) by atlas.frec.bull.fr (Postfix) with ESMTP id 7824EA1852; Mon, 10 Mar 2014 16:39:10 +0100 (CET) Received: (from derr@localhost) by atlas.frec.bull.fr (8.14.4/8.14.4/Submit) id s2AFdAtE015245; Mon, 10 Mar 2014 16:39:10 +0100 From: Simon Derr To: v9fs-developer@lists.sourceforge.net Date: Mon, 10 Mar 2014 16:38:51 +0100 Message-Id: <1394465932-11520-4-git-send-email-simon.derr@bull.net> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: <1394465932-11520-1-git-send-email-simon.derr@bull.net> References: <1394465932-11520-1-git-send-email-simon.derr@bull.net> X-Spam-Score: -0.0 (/) X-Headers-End: 1WN2nJ-0005CY-Fp Subject: [V9fs-developer] [PATCH 3/4] 9pnet_rdma: add cancelled() X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Take into account posted recv buffers that will never receive their reply. The RDMA code posts a recv buffer for each request that it sends. When a request is flushed, it is possible that this request will never receive a reply, and that one recv buffer will stay unused on the recv queue. It is then possible, if this scenario happens several times, to have the recv queue full, and have the 9pnet_rmda module unable to send new requests. Signed-off-by: Simon Derr --- net/9p/trans_rdma.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index b374c57..8f5e4f7 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -587,12 +587,24 @@ static struct p9_trans_rdma *alloc_rdma(struct p9_rdma_opts *opts) return rdma; } -/* its not clear to me we can do anything after send has been posted */ static int rdma_cancel(struct p9_client *client, struct p9_req_t *req) { + /* Nothing to do here. + * We will take care of it (if we have to) in rdma_cancelled() + */ return 1; } +/* A request has been fully flushed without a reply. + * That means we have posted one buffer in excess. + */ +static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req) +{ + struct p9_trans_rdma *rdma = client->trans; + atomic_inc(&rdma->excess_rc); + return 0; +} + /** * trans_create_rdma - Transport method for creating atransport instance * @client: client instance @@ -726,6 +738,7 @@ static struct p9_trans_module p9_rdma_trans = { .close = rdma_close, .request = rdma_request, .cancel = rdma_cancel, + .cancelled = rdma_cancelled, }; /**