Re: [PATCH 5/6] xfs_repair: check plausibility of root dir pointer before trashing it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 30, 2020 at 02:18:52PM -0600, Eric Sandeen wrote:
> On 1/23/20 6:17 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > If sb_rootino doesn't point to where we think mkfs should have allocated
> > the root directory, check to see if the alleged root directory actually
> > looks like a root directory.  If so, we'll let it live because someone
> > could have changed sunit since formatting time, and that changes the
> > root directory inode estimate.
> 
> I forget, is there an fstest for this?

https://lore.kernel.org/linux-xfs/20191218041831.GK12765@magnolia/

> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> ...
> 
> > @@ -438,6 +469,20 @@ calc_mkfs(
> >  
> >  	rootino = libxfs_ialloc_calc_rootino(mp, mp->m_sb.sb_unit);
> >  
> > +	/*
> > +	 * If the root inode isn't where we think it is, check its plausibility
> > +	 * as a root directory.  It's possible that somebody changed sunit
> > +	 * since the filesystem was created, which can change the value of the
> > +	 * above computation.  Don't blow up the root directory if this is the
> > +	 * case.
> > +	 */
> > +	if (mp->m_sb.sb_rootino != rootino && has_plausible_rootdir(mp)) {
> > +		do_warn(
> > +_("sb root inode value %" PRIu64 " inconsistent with alignment (expected %"PRIu64")\n"),
> > +			mp->m_sb.sb_rootino, rootino);
> 
> what would a user do with this warning?  Is there any value in emitting it?
> 
> Otherwise this looks good.

I dunno -- on the one hand, I understand that nobody wants to deal with
the support calls that will erupt from that message.  On the other hand,
it's an indication that this filesystem isn't /quite/ the way we
expected it to be, and that would be a helpful hint if you were
debugging some other weird problem with an xfs filesystem.

What if this were a do_log()?

--D
> 
> 
> > +		rootino = mp->m_sb.sb_rootino;
> > +	}
> > +
> >  	ensure_fixed_ino(&mp->m_sb.sb_rootino, rootino,
> >  			_("root"));
> >  	ensure_fixed_ino(&mp->m_sb.sb_rbmino, rootino + 1,
> > 



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux