From: Darrick J. Wong <djwong@xxxxxxxxxx> Directory parent pointers require logged extended attribute updates to maintain referential integrity with dirent updates. Make sure that the log incompat bit never goes away. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- fs/xfs/xfs_mount.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 8d56ec1779f26..62351fdde2c80 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -620,6 +620,31 @@ xfs_agbtree_compute_maxlevels( mp->m_agbtree_maxlevels = max(levels, mp->m_refc_maxlevels); } +/* + * Mark certain log incompat feature bits as sticky, and make sure they're + * enabled. + */ +STATIC int +xfs_mountfs_set_perm_log_features( + struct xfs_mount *mp) +{ + if (xfs_has_parent(mp)) { + /* + * Directory parent pointers require logged extended attribute + * updates to maintain referential integrity with dirent + * updates. Set the LARP bit. + */ + mp->m_perm_log_incompat |= XFS_SB_FEAT_INCOMPAT_LOG_XATTRS; + } + + /* Make sure the permanent bits are set in the ondisk primary super. */ + if ((mp->m_sb.sb_features_log_incompat & mp->m_perm_log_incompat) == + mp->m_perm_log_incompat) + return 0; + + return xfs_add_incompat_log_features(mp, mp->m_perm_log_incompat); +} + /* * This function does the following on an initial mount of a file system: * - reads the superblock from disk and init the mount struct @@ -826,6 +851,12 @@ xfs_mountfs( goto out_inodegc_shrinker; } + error = xfs_mountfs_set_perm_log_features(mp); + if (error) { + xfs_warn(mp, "setting permanent log incompat features failed"); + goto out_inodegc_shrinker; + } + /* Enable background inode inactivation workers. */ xfs_inodegc_start(mp); xfs_blockgc_start(mp);