[Ocfs2-tools-devel] [PATCH] debugfs.ocfs2: fix the endian error in find_block_inode

Sunil Mushran sunil.mushran at oracle.com
Wed May 2 11:28:44 PDT 2007


Joel, ok.

Tao, Good catch. However it is still missing the fs_generation check.
Ensure the di->i_fs_generation is valid too.


On Tue, 2007-05-01 at 19:30 -0700, Joel Becker wrote:
> On Tue, May 01, 2007 at 02:59:53PM -0700, Sunil Mushran wrote:
> > Shouldn't this be fixed in ocfs2_get_next_inode()? As in, all this
> > endian swapping business needs to be done in the libocfs2 not the
> > individual tools.
> > 
> > Joel?
> 
> r1035 | zab | 2005-08-10 13:17:37 -0700 (Wed, 10 Aug 2005) | 7 lines
> 
> Oops, don't check signatures down in the scan inode interface.
> It's meant to be much more low level than that, callers are
> expected to swap after verifying signatures.
> 
> Also update some debugging macros I used when tracking this down.
> 
> 	I think what Zach was doing here is that an inode scan comes up
> with unallocated -- and *uninitialized* -- blocks in the inode files.
> So you can't safely swap them.  Things like next_free_rec are completely
> invalid.
> 	The original consumer of inode_scan() is fsck(8).  It gets the
> raw blocks from the inode allocator and checks the signature before
> trusting that swap_inode() will work.
> 
> Joel
> 
> > 
> > On Sat, 2007-04-28 at 14:22 +0800, tao.ma wrote:
> > > Function find_block_inode forget to swap the information from disk to 
> > > cpu. This may cause problem in some big-endian machine.
> > > 
> > > plain text document attachment (find_block_inode.patch)
> > > Index: debugfs.ocfs2/find_block_inode.c
> > > ===================================================================
> > > --- debugfs.ocfs2/find_block_inode.c	(revision 1346)
> > > +++ debugfs.ocfs2/find_block_inode.c	(working copy)
> > > @@ -368,6 +368,8 @@ errcode_t find_block_inode(ocfs2_filesys
> > >  			   strlen(OCFS2_INODE_SIGNATURE)))
> > >  			continue;
> > >  
> > > +		ocfs2_swap_inode_to_cpu(di);
> > > +
> > >  		if (!(di->i_flags & OCFS2_VALID_FL))
> > >  			continue;
> > >  
> > > _______________________________________________
> > > Ocfs2-tools-devel mailing list
> > > Ocfs2-tools-devel at oss.oracle.com
> > > http://oss.oracle.com/mailman/listinfo/ocfs2-tools-devel
> > 
> > 
> > _______________________________________________
> > 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