diff mbox

fio test triggering bad data on ext4

Message ID 4C1B90AE.1050703@redhat.com
State Rejected, archived
Headers show

Commit Message

Eric Sandeen June 18, 2010, 3:28 p.m. UTC
Jens Axboe wrote:
> On 18/06/10 16.59, Eric Sandeen wrote:
>   
>> Eric Sandeen wrote:
>>     
>>> Jens Axboe wrote:
>>>       
>>>> Hi,
>>>>
>>>> I was writing a small fio job file to do writes and read verifies on a
>>>> device. It forks 32 processes, each writing randomly to 4 files with a
>>>> block size between 4k and 16k. When it has written 1024 of those blocks,
>>>> it'll verify the oldest 512 of them. Each block is checksummed for every
>>>> 512b. It uses libaio and O_DIRECT.
>>>>
>>>> It works on ext2 and btrfs. I haven't run it to completion yet, but they
>>>> survive 15-20 minutes just fine. ext4 doesn't even go a full minutes
>>>> before this triggers:
>>>>         
>>> Jens, can you try XFS too?  Since ext3 can't do direct IO to a hole,
>>> (and I'm not sure about btrfs in that regard), ext4 may be most similar
>>> to xfs's behavior on the test ... wondering how it fares.
>>>
>>> Thanks,
>>> -Eric
>>>       
>> Actually mingming had a patch for direct-io.c which may be related, I'll
>> test that out.
>>     
>
> OK, I'll try XFS tonight as well.
>
>
>   
I haven't been able to reproduce it on ext4 here, yet.

FWIW here's the patch from mingming:

When unaligned DIO writes, skip zero out the block if the buffer is marked
unwritten. That means there is an asynconous direct IO (append or fill the hole)
still pending.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
 fs/direct-io.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



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

Comments

Jens Axboe June 18, 2010, 5:32 p.m. UTC | #1
On 2010-06-18 17:28, Eric Sandeen wrote:
> Jens Axboe wrote:
>> On 18/06/10 16.59, Eric Sandeen wrote:
>>   
>>> Eric Sandeen wrote:
>>>     
>>>> Jens Axboe wrote:
>>>>       
>>>>> Hi,
>>>>>
>>>>> I was writing a small fio job file to do writes and read verifies on a
>>>>> device. It forks 32 processes, each writing randomly to 4 files with a
>>>>> block size between 4k and 16k. When it has written 1024 of those blocks,
>>>>> it'll verify the oldest 512 of them. Each block is checksummed for every
>>>>> 512b. It uses libaio and O_DIRECT.
>>>>>
>>>>> It works on ext2 and btrfs. I haven't run it to completion yet, but they
>>>>> survive 15-20 minutes just fine. ext4 doesn't even go a full minutes
>>>>> before this triggers:
>>>>>         
>>>> Jens, can you try XFS too?  Since ext3 can't do direct IO to a hole,
>>>> (and I'm not sure about btrfs in that regard), ext4 may be most similar
>>>> to xfs's behavior on the test ... wondering how it fares.
>>>>
>>>> Thanks,
>>>> -Eric
>>>>       
>>> Actually mingming had a patch for direct-io.c which may be related, I'll
>>> test that out.
>>>     
>>
>> OK, I'll try XFS tonight as well.
>>
>>
>>   
> I haven't been able to reproduce it on ext4 here, yet.
> 
> FWIW here's the patch from mingming:
> 
> When unaligned DIO writes, skip zero out the block if the buffer is marked
> unwritten. That means there is an asynconous direct IO (append or fill the hole)
> still pending.
> 
> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> ---
>  fs/direct-io.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Index: linux-git/fs/direct-io.c
> ===================================================================
> --- linux-git.orig/fs/direct-io.c	2010-05-07 15:42:22.855033403 -0700
> +++ linux-git/fs/direct-io.c	2010-05-07 15:44:17.695007770 -0700
> @@ -740,7 +740,8 @@
>  	struct page *page;
>  
>  	dio->start_zero_done = 1;
> -	if (!dio->blkfactor || !buffer_new(&dio->map_bh))
> +	if (!dio->blkfactor || !buffer_new(&dio->map_bh)
> +	    || buffer_unwritten(&dio->map_bh))
>  		return;
>  
>  	dio_blocks_per_fs_block = 1 << dio->blkfactor;
> 
> 

What is this patch against?
Eric Sandeen June 18, 2010, 6:04 p.m. UTC | #2
Jens Axboe wrote:
> On 2010-06-18 17:28, Eric Sandeen wrote:
>> Jens Axboe wrote:
>>> On 18/06/10 16.59, Eric Sandeen wrote:
>>>   
>>>> Eric Sandeen wrote:
>>>>     
>>>>> Jens Axboe wrote:
>>>>>       
>>>>>> Hi,
>>>>>>
>>>>>> I was writing a small fio job file to do writes and read verifies on a
>>>>>> device. It forks 32 processes, each writing randomly to 4 files with a
>>>>>> block size between 4k and 16k. When it has written 1024 of those blocks,
>>>>>> it'll verify the oldest 512 of them. Each block is checksummed for every
>>>>>> 512b. It uses libaio and O_DIRECT.
>>>>>>
>>>>>> It works on ext2 and btrfs. I haven't run it to completion yet, but they
>>>>>> survive 15-20 minutes just fine. ext4 doesn't even go a full minutes
>>>>>> before this triggers:
>>>>>>         
>>>>> Jens, can you try XFS too?  Since ext3 can't do direct IO to a hole,
>>>>> (and I'm not sure about btrfs in that regard), ext4 may be most similar
>>>>> to xfs's behavior on the test ... wondering how it fares.
>>>>>
>>>>> Thanks,
>>>>> -Eric
>>>>>       
>>>> Actually mingming had a patch for direct-io.c which may be related, I'll
>>>> test that out.
>>>>     
>>> OK, I'll try XFS tonight as well.
>>>
>>>
>>>   
>> I haven't been able to reproduce it on ext4 here, yet.
>>
>> FWIW here's the patch from mingming:
>>
>> When unaligned DIO writes, skip zero out the block if the buffer is marked
>> unwritten. That means there is an asynconous direct IO (append or fill the hole)
>> still pending.
>>
>> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>> ---
>>  fs/direct-io.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Index: linux-git/fs/direct-io.c
>> ===================================================================
>> --- linux-git.orig/fs/direct-io.c	2010-05-07 15:42:22.855033403 -0700
>> +++ linux-git/fs/direct-io.c	2010-05-07 15:44:17.695007770 -0700
>> @@ -740,7 +740,8 @@
>>  	struct page *page;
>>  
>>  	dio->start_zero_done = 1;
>> -	if (!dio->blkfactor || !buffer_new(&dio->map_bh))
>> +	if (!dio->blkfactor || !buffer_new(&dio->map_bh)
>> +	    || buffer_unwritten(&dio->map_bh))
>>  		return;
>>  
>>  	dio_blocks_per_fs_block = 1 << dio->blkfactor;
>>
>>
> 
> What is this patch against?
> 

Applied to 2.6.32, seems to apply upstream as well.

It hits dio_zero-block()

-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jens Axboe June 18, 2010, 6:14 p.m. UTC | #3
On 2010-06-18 20:04, Eric Sandeen wrote:
> Jens Axboe wrote:
>> On 2010-06-18 17:28, Eric Sandeen wrote:
>>> Jens Axboe wrote:
>>>> On 18/06/10 16.59, Eric Sandeen wrote:
>>>>   
>>>>> Eric Sandeen wrote:
>>>>>     
>>>>>> Jens Axboe wrote:
>>>>>>       
>>>>>>> Hi,
>>>>>>>
>>>>>>> I was writing a small fio job file to do writes and read verifies on a
>>>>>>> device. It forks 32 processes, each writing randomly to 4 files with a
>>>>>>> block size between 4k and 16k. When it has written 1024 of those blocks,
>>>>>>> it'll verify the oldest 512 of them. Each block is checksummed for every
>>>>>>> 512b. It uses libaio and O_DIRECT.
>>>>>>>
>>>>>>> It works on ext2 and btrfs. I haven't run it to completion yet, but they
>>>>>>> survive 15-20 minutes just fine. ext4 doesn't even go a full minutes
>>>>>>> before this triggers:
>>>>>>>         
>>>>>> Jens, can you try XFS too?  Since ext3 can't do direct IO to a hole,
>>>>>> (and I'm not sure about btrfs in that regard), ext4 may be most similar
>>>>>> to xfs's behavior on the test ... wondering how it fares.
>>>>>>
>>>>>> Thanks,
>>>>>> -Eric
>>>>>>       
>>>>> Actually mingming had a patch for direct-io.c which may be related, I'll
>>>>> test that out.
>>>>>     
>>>> OK, I'll try XFS tonight as well.
>>>>
>>>>
>>>>   
>>> I haven't been able to reproduce it on ext4 here, yet.
>>>
>>> FWIW here's the patch from mingming:
>>>
>>> When unaligned DIO writes, skip zero out the block if the buffer is marked
>>> unwritten. That means there is an asynconous direct IO (append or fill the hole)
>>> still pending.
>>>
>>> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>>> ---
>>>  fs/direct-io.c |    3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> Index: linux-git/fs/direct-io.c
>>> ===================================================================
>>> --- linux-git.orig/fs/direct-io.c	2010-05-07 15:42:22.855033403 -0700
>>> +++ linux-git/fs/direct-io.c	2010-05-07 15:44:17.695007770 -0700
>>> @@ -740,7 +740,8 @@
>>>  	struct page *page;
>>>  
>>>  	dio->start_zero_done = 1;
>>> -	if (!dio->blkfactor || !buffer_new(&dio->map_bh))
>>> +	if (!dio->blkfactor || !buffer_new(&dio->map_bh)
>>> +	    || buffer_unwritten(&dio->map_bh))
>>>  		return;
>>>  
>>>  	dio_blocks_per_fs_block = 1 << dio->blkfactor;
>>>
>>>
>>
>> What is this patch against?
>>
> 
> Applied to 2.6.32, seems to apply upstream as well.
> 
> It hits dio_zero-block()

Irk indeed, I am blind. The patch does not fix it.
Jens Axboe June 21, 2010, 10:20 a.m. UTC | #4
On 2010-06-18 20:14, Jens Axboe wrote:
> On 2010-06-18 20:04, Eric Sandeen wrote:
>> Jens Axboe wrote:
>>> On 2010-06-18 17:28, Eric Sandeen wrote:
>>>> Jens Axboe wrote:
>>>>> On 18/06/10 16.59, Eric Sandeen wrote:
>>>>>   
>>>>>> Eric Sandeen wrote:
>>>>>>     
>>>>>>> Jens Axboe wrote:
>>>>>>>       
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I was writing a small fio job file to do writes and read verifies on a
>>>>>>>> device. It forks 32 processes, each writing randomly to 4 files with a
>>>>>>>> block size between 4k and 16k. When it has written 1024 of those blocks,
>>>>>>>> it'll verify the oldest 512 of them. Each block is checksummed for every
>>>>>>>> 512b. It uses libaio and O_DIRECT.
>>>>>>>>
>>>>>>>> It works on ext2 and btrfs. I haven't run it to completion yet, but they
>>>>>>>> survive 15-20 minutes just fine. ext4 doesn't even go a full minutes
>>>>>>>> before this triggers:
>>>>>>>>         
>>>>>>> Jens, can you try XFS too?  Since ext3 can't do direct IO to a hole,
>>>>>>> (and I'm not sure about btrfs in that regard), ext4 may be most similar
>>>>>>> to xfs's behavior on the test ... wondering how it fares.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> -Eric
>>>>>>>       
>>>>>> Actually mingming had a patch for direct-io.c which may be related, I'll
>>>>>> test that out.
>>>>>>     
>>>>> OK, I'll try XFS tonight as well.
>>>>>
>>>>>
>>>>>   
>>>> I haven't been able to reproduce it on ext4 here, yet.
>>>>
>>>> FWIW here's the patch from mingming:
>>>>
>>>> When unaligned DIO writes, skip zero out the block if the buffer is marked
>>>> unwritten. That means there is an asynconous direct IO (append or fill the hole)
>>>> still pending.
>>>>
>>>> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>>>> ---
>>>>  fs/direct-io.c |    3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> Index: linux-git/fs/direct-io.c
>>>> ===================================================================
>>>> --- linux-git.orig/fs/direct-io.c	2010-05-07 15:42:22.855033403 -0700
>>>> +++ linux-git/fs/direct-io.c	2010-05-07 15:44:17.695007770 -0700
>>>> @@ -740,7 +740,8 @@
>>>>  	struct page *page;
>>>>  
>>>>  	dio->start_zero_done = 1;
>>>> -	if (!dio->blkfactor || !buffer_new(&dio->map_bh))
>>>> +	if (!dio->blkfactor || !buffer_new(&dio->map_bh)
>>>> +	    || buffer_unwritten(&dio->map_bh))
>>>>  		return;
>>>>  
>>>>  	dio_blocks_per_fs_block = 1 << dio->blkfactor;
>>>>
>>>>
>>>
>>> What is this patch against?
>>>
>>
>> Applied to 2.6.32, seems to apply upstream as well.
>>
>> It hits dio_zero-block()
> 
> Irk indeed, I am blind. The patch does not fix it.

So just to confirm that this isn't a new regression, 2.6.34 fails in the
same way. If I change the test to make the random writes overwrite
existing blocks instead of filling holes, then there are no problems
either.
diff mbox

Patch

Index: linux-git/fs/direct-io.c
===================================================================
--- linux-git.orig/fs/direct-io.c	2010-05-07 15:42:22.855033403 -0700
+++ linux-git/fs/direct-io.c	2010-05-07 15:44:17.695007770 -0700
@@ -740,7 +740,8 @@ 
 	struct page *page;
 
 	dio->start_zero_done = 1;
-	if (!dio->blkfactor || !buffer_new(&dio->map_bh))
+	if (!dio->blkfactor || !buffer_new(&dio->map_bh)
+	    || buffer_unwritten(&dio->map_bh))
 		return;
 
 	dio_blocks_per_fs_block = 1 << dio->blkfactor;