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? > 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. > + 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, >