From patchwork Thu Apr 21 08:11:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M. Mohan Kumar" X-Patchwork-Id: 724181 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3L8Bth0022376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Apr 2011 08:12:16 GMT 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.74) (envelope-from ) id 1QCoz9-0006hM-EG; Thu, 21 Apr 2011 08:11:35 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.74) (envelope-from ) id 1QCoz8-0006hG-4W for v9fs-developer@lists.sourceforge.net; Thu, 21 Apr 2011 08:11:34 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of in.ibm.com designates 202.81.31.141 as permitted sender) client-ip=202.81.31.141; envelope-from=mohan@in.ibm.com; helo=e23smtp08.au.ibm.com; Received: from e23smtp08.au.ibm.com ([202.81.31.141]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.74) id 1QCoz6-0001rR-QK for v9fs-developer@lists.sourceforge.net; Thu, 21 Apr 2011 08:11:34 +0000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp08.au.ibm.com (8.14.4/8.13.1) with ESMTP id p3L86Il5013649 for ; Thu, 21 Apr 2011 18:06:18 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3L8BPsc2387980 for ; Thu, 21 Apr 2011 18:11:25 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3L8BOJn023838 for ; Thu, 21 Apr 2011 18:11:25 +1000 Received: from explorer.in.ibm.com ([9.124.35.21]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p3L8BNPY023819; Thu, 21 Apr 2011 18:11:24 +1000 From: "M. Mohan Kumar" To: v9fs-developer@lists.sourceforge.net Date: Thu, 21 Apr 2011 13:41:22 +0530 Message-Id: <1303373482-7076-1-git-send-email-mohan@in.ibm.com> X-Mailer: git-send-email 1.7.4 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1QCoz6-0001rR-QK Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [V9fs-developer] [PATCH] [V2] net/9p: Handle get_user_pages_fast return properly 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Apr 2011 08:12:16 +0000 (UTC) Use proper data type to handle get_user_pages_fast error condition. Also do not treat EFAULT error as fatal. Signed-off-by: M. Mohan Kumar --- Changes from previous version: Retain printing error message in case get_user_pages_fast fails net/9p/client.c | 2 +- net/9p/trans_common.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c index 691a04a..1612142 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -614,7 +614,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...) err = c->trans_mod->request(c, req); if (err < 0) { - if (err != -ERESTARTSYS) + if (err != -ERESTARTSYS && err != -EFAULT) c->status = Disconnected; goto reterr; } diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c index 14265e8..0e73e07 100644 --- a/net/9p/trans_common.c +++ b/net/9p/trans_common.c @@ -63,7 +63,7 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len, int nr_pages, u8 rw) { uint32_t first_page_bytes = 0; - uint32_t pdata_mapped_pages; + int32_t pdata_mapped_pages; struct trans_rpage_info *rpinfo; *pdata_off = (__force size_t)req->tc->pubuf & (PAGE_SIZE-1); @@ -75,13 +75,11 @@ p9_payload_gup(struct p9_req_t *req, size_t *pdata_off, int *pdata_len, rpinfo = req->tc->private; pdata_mapped_pages = get_user_pages_fast((unsigned long)req->tc->pubuf, nr_pages, rw, &rpinfo->rp_data[0]); - - if (pdata_mapped_pages < 0) { + if (pdata_mapped_pages <= 0) { printk(KERN_ERR "get_user_pages_fast failed:%d udata:%p" "nr_pages:%d\n", pdata_mapped_pages, req->tc->pubuf, nr_pages); - pdata_mapped_pages = 0; - return -EIO; + return pdata_mapped_pages ; } rpinfo->rp_nr_pages = pdata_mapped_pages; if (*pdata_off) {