[Ocfs2-tools-devel] [PATCH 4/4] Ocfs2-tools: Fix bug in libocfs2's swap code to let fswreck behave correctly in big endian machine.

Tao Ma tao.ma at oracle.com
Wed Jun 24 18:58:54 PDT 2009


Hi Tristan,

Tristan Ye wrote:
> Currently, ocfs2_write_inode() and ocfs2_read_inode() in libocfs2 will swap
> all its field to make it big-endian compatible when writting to disk or reading
> from disk. It will be fine when we write/read the inode/extent in a normal case,
> which means the field of inode we're going to write/read is correct. However, in
> the fswreck's case, we corrupted some fields(such as cl_next_free_rec, tl_count etc)
> which will be used later as a count number to swap rec[i]'s field in a loop. that will
> definitely leads to an error in a big-endian platform where swap code being introduced.
> 
> The strategy we use here is to correct the count number in libocfs2 swap code just like
> fsck.ocfs2 did. Note that we only correct the count number but leave the field which
> corrupted by fswreck unchanged there.
I don't think it is a good way. libocfs2 is used for a sane program 
while fswreck is used to corrupt the file system. So I don't think we 
should add some extra check in libocfs2 for the only user(fswreck). 
fswreck should handle this by itself.

Joel,
	What's your option?

Regards,
Tao




More information about the Ocfs2-tools-devel mailing list