From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Venkateswararao Jujjuri (JV)" Subject: Re: [RFC-V3 7/7] [net/9p] Handle TREAD/RERROR case in !dotl case. Date: Fri, 11 Feb 2011 10:46:42 -0800 Message-ID: <4D558412.6030805@linux.vnet.ibm.com> References: <1297387511-2697-1-git-send-email-jvrao@linux.vnet.ibm.com> <1297387511-2697-8-git-send-email-jvrao@linux.vnet.ibm.com> <87pqqyo31t.fsf@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org To: "Aneesh Kumar K. V" Return-path: Received: from e32.co.us.ibm.com ([32.97.110.150]:51587 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752146Ab1BKSqr (ORCPT ); Fri, 11 Feb 2011 13:46:47 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e32.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p1BIaT2g019993 for ; Fri, 11 Feb 2011 11:36:29 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1BIkkku066888 for ; Fri, 11 Feb 2011 11:46:46 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1BIkkie014907 for ; Fri, 11 Feb 2011 11:46:46 -0700 In-Reply-To: <87pqqyo31t.fsf@linux.vnet.ibm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 2/11/2011 10:10 AM, Aneesh Kumar K. V wrote: > On Thu, 10 Feb 2011 17:25:11 -0800, "Venkateswararao Jujjuri (JV)" wrote: >> In addition, this patch also avoids zero copy for short reads in !dotl case. >> >> Signed-off-by: Venkateswararao Jujjuri >> --- >> net/9p/client.c | 64 +++++++++++++++++++++++++++++++++++------------------- >> 1 files changed, 41 insertions(+), 23 deletions(-) >> >> diff --git a/net/9p/client.c b/net/9p/client.c >> index f6d8531..3e51273 100644 >> --- a/net/9p/client.c >> +++ b/net/9p/client.c >> @@ -443,6 +443,7 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) >> { >> int8_t type; >> int err; >> + int ecode; >> >> err = p9_parse_header(req->rc, NULL, &type, NULL, 0); >> if (err) { >> @@ -450,36 +451,53 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) >> return err; >> } >> >> - if (type == P9_RERROR || type == P9_RLERROR) { >> - int ecode; >> - >> - if (!p9_is_proto_dotl(c)) { >> - char *ename; >> + if (type != P9_RERROR && type != P9_RLERROR) >> + return 0; >> >> - err = p9pdu_readf(req->rc, c->proto_version, "s?d", >> - &ename, &ecode); >> - if (err) >> - goto out_err; >> + if (!p9_is_proto_dotl(c)) { >> + char *ename; >> + >> + if (req->tc->pbuf_size) { >> + /* Handle user buffers */ >> + size_t len = req->rc->size - req->rc->offset; >> + if (req->tc->pubuf) { >> + /* User Buffer */ >> + err = copy_from_user( >> + &req->rc->sdata[req->rc->offset], >> + req->tc->pubuf, len); >> + if (err) { >> + err = -EFAULT; >> + return err; >> + } > > Will this handle error resulting from kernel_read ?. I guess we have a > kernel address there. Yes. It should work. copy_to/from_user works fine..if you recall this how the code is in the client_read(). - JV > > >> + } else { >> + /* Kernel Buffer */ >> + memmove(&req->rc->sdata[req->rc->offset], >> + req->tc->pkbuf, len); >> + } >> + } > > -aneesh