Re: [PATCH] xfs_repair: Fix root inode's parent when it's bogus for sf directory
From: Marco Benatto <hidden>
Date: 2018-06-15 17:30:29
On Thu, Jun 14, 2018 at 8:35 PM, Dave Chinner [off-list ref] wrote:
On Thu, Jun 14, 2018 at 05:20:56PM -0500, Eric Sandeen wrote:quoted
On 6/14/18 5:16 PM, Marco Benatto wrote:quoted
Currently when root inode is in short-form and its parent ino has an invalid value, process_sf_dir2() ends up not fixing it, because if verify_inum() fails we never get to the next case which would fix the root inode's parent pointer. This behavior triggers the following assert on process_dir2(): ASSERT((ino != mp->m_sb.sb_rootino && ino != *parent) || (ino == mp->m_sb.sb_rootino && (ino == *parent || need_root_dotdot == 1))); This patch fixes this behavior by making sure we always properly handle rootino parent pointer in process_sf_dir2() Signed-off-by: Marco Benatto <redacted>This looks correct to me, thanks. FWIW the problem can be demonstrated by setting the root inode's parent to 0 on a freshly made fs: # mkfs.xfs -f -dfile,name=fsfile,size=1g # xfs_db -x -c "sb 0" -c "addr rootino" -c "write u3.sfdir3.hdr.parent.i4 0" fsfile # xfs_repair fsfilexfstest please (also to check that xfs_scrub detects it)?
Sure, working on this. I'll send you once it's done.
Cheers, Dave. -- Dave Chinner david@fromorbit.com
Cheers, -- Marco Benatto