lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 30 Jul 2012 08:40:11 +0800
From:	majianpeng <majianpeng@...il.com>
To:	"Jeff Moyer" <jmoyer@...hat.com>
Cc:	viro <viro@...IV.linux.org.uk>, "Neil Brown" <neilb@...e.de>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-raid <linux-raid@...r.kernel.org>
Subject: Re: Re: [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.

On 2012-07-27 22:21 Jeff Moyer <jmoyer@...hat.com> Wrote:
>majianpeng <majianpeng@...il.com> writes:
>
>> When exec bio_alloc, the bi_rw is zero.But after calling bio_add_page,
>> it will use bi_rw.
>> Fox example, in functiion __bio_add_page,it will call merge_bvec_fn().
>> The merge_bvec_fn of raid456 will use the bi_rw to judge the merge.
>>>> if ((bvm->bi_rw & 1) == WRITE)
>>>>		return biovec->bv_len; /* always allow writes to be mergeable */
>>
>> Signed-off-by: Jianpeng Ma <majianpeng@...il.com>
>
>Good catch.  How did you find this?  Did you experience data corruption
>as a result of this oversight, reduced performance due to missed merge
>opportunities, or did you just notice it in reviewing the code?
>
>Reviewed-by: Jeff Moyer <jmoyer@...hat.com>
>
Sorry for late to reply. When i analysed the performance of raid5, i found this bug.

>>
>> There are many place like this in kernel.If you think this patch ok, i will correct those.
>> ---
>>  fs/direct-io.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/direct-io.c b/fs/direct-io.c
>> index 1faf4cb..77f0bbf 100644
>> --- a/fs/direct-io.c
>> +++ b/fs/direct-io.c
>> @@ -349,6 +349,7 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
>>  
>>  	bio->bi_bdev = bdev;
>>  	bio->bi_sector = first_sector;
>> +	bio->bi_rw = dio->rw;
>>  	if (dio->is_async)
>>  		bio->bi_end_io = dio_bio_end_aio;
>>  	else

Powered by blists - more mailing lists