Re: [RFC-V3 7/7] [net/9p] Handle TREAD/RERROR case in !dotl case.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/11/2011 10:10 AM, Aneesh Kumar K. V wrote:
> On Thu, 10 Feb 2011 17:25:11 -0800, "Venkateswararao Jujjuri (JV)" <jvrao@xxxxxxxxxxxxxxxxxx> wrote:
>> In addition, this patch also avoids zero copy for short reads in !dotl case.
>>
>> Signed-off-by: Venkateswararao Jujjuri <jvrao@xxxxxxxxxxxxxxxxxx>
>> ---
>>  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


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux