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

Joel Becker Joel.Becker at oracle.com
Thu Jun 25 12:08:33 PDT 2009


On Thu, Jun 25, 2009 at 09:58:54AM +0800, Tao Ma wrote:
> 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?

	See bugzilla #1109.  The patch is also in the 'swap' branch of
/build/jlbec/ocfs2-tools/working.

Joel

-- 

"I think it would be a good idea."  
        - Mahatma Ghandi, when asked what he thought of Western
          civilization

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list