From: Darrick J. Wong Date: Fri, 26 Apr 2019 20:39:17 +0000 (-0500) Subject: xfs_repair: reinitialize the root directory nlink correctly X-Git-Tag: v5.0.0-rc1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1da4e1f0e61c076bb11ad166f10b1fb338852bdb;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: reinitialize the root directory nlink correctly In mk_root_dir, we reinitialize the root directory inode with a link count of 1. This differs from mkfs parseproto, which initializes the root to have a link count of 2. The nlink discrepancy in repair is caught and corrected during phase 7, but this is unnecessary since we should set it properly in the first place. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/repair/phase6.c b/repair/phase6.c index 9477bc252..8a50b350a 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -891,7 +891,7 @@ mk_root_dir(xfs_mount_t *mp) ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; - set_nlink(VFS_I(ip), 1); /* account for . */ + set_nlink(VFS_I(ip), 2); /* account for . and .. */ times = XFS_ICHGTIME_CHG | XFS_ICHGTIME_MOD; if (ip->i_d.di_version == 3) {