[Ocfs2-tools-devel] [PATCH 4/4] Ocfs2-tools: Fix bug in fswreck to let LALLOC_* prompt codes behave correctly.

Sunil Mushran sunil.mushran at oracle.com
Fri Jun 26 10:27:20 PDT 2009


Yeah. Good catch Tristan.

BTW, do you have a big endian machine to test this on?
Wondering as we not only have ppcs, we also have some
sessions on s390x that are not used regularly.

Tao Ma wrote:
> Oh, this is really a bug.
> SOB.
>
> Tristan Ye wrote:
>   
>> Joel,
>>
>> I've tested your patch '[PATCH] libocfs2: Prevent endian swapping
>> from scribbling over memory', it resolves almost all of the failure
>> fswreck hit in ppc arch, However, some prompt codes in fswreck still
>> failed with your patch, cause the problem was in fswreck's code.
>>
>> We don't need to swap the inode's field after reading the block from
>> disk in fswreck's code, since it has been done by ocfs2_read_inode()
>> in libocfs2. this patch help following prompt codes survive from failure
>> in big-endian system.
>>
>> 	LALLOC_BM_SIZE
>> 	LALLOC_BM_OVERRUN
>> 	LALLOC_BM_STRADDL
>> 	LALLOC_USED_OVERRUN
>> 	LALLOC_CLEAR
>>
>> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
>> ---
>>  fswreck/local_alloc.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/fswreck/local_alloc.c b/fswreck/local_alloc.c
>> index b95efcc..eb9187e 100644
>> --- a/fswreck/local_alloc.c
>> +++ b/fswreck/local_alloc.c
>> @@ -87,10 +87,10 @@ static void create_local_alloc(ocfs2_filesys *fs, uint64_t blkno)
>>  
>>  	la = &(di->id2.i_lab);
>>  
>> -	la->la_bm_off = cpu_to_le32(la_off);
>> -	di->id1.bitmap1.i_total = cpu_to_le32(la_size);
>> +	la->la_bm_off = la_off;
>> +	di->id1.bitmap1.i_total = la_size;
>>  	di->id1.bitmap1.i_used = 0;
>> -	memset(la->la_bitmap, 0, le16_to_cpu(la->la_size));
>> +	memset(la->la_bitmap, 0, la->la_size);
>>  	
>>  	ret = ocfs2_write_inode(fs, blkno, buf);
>>  	if (ret)
>>     
>
> _______________________________________________
> Ocfs2-tools-devel mailing list
> Ocfs2-tools-devel at oss.oracle.com
> http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
>   




More information about the Ocfs2-tools-devel mailing list