From: Darrick J. Wong Date: Mon, 25 Nov 2024 21:14:18 +0000 (-0800) Subject: xfs: adjust xfs_bmap_add_attrfork for metadir X-Git-Tag: v6.13.0~179 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=52d695723abda8b96d22489ce9f38a06e4fa0a1a;p=thirdparty%2Fxfsprogs-dev.git xfs: adjust xfs_bmap_add_attrfork for metadir Source kernel commit: 61b6bdb30a4bee1f3417081aedfe9e346538f897 Online repair might use the xfs_bmap_add_attrfork to repair a file in the metadata directory tree if (say) the metadata file lacks the correct parent pointers. In that case, it is not correct to check that the file is dqattached -- metadata files must be not have /any/ dquot attached at all. Adjust the assertions appropriately. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index 150aaddf..7567014a 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -1003,7 +1003,10 @@ xfs_attr_add_fork( unsigned int blks; /* space reservation */ int error; /* error return value */ - ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); + if (xfs_is_metadir_inode(ip)) + ASSERT(XFS_IS_DQDETACHED(ip)); + else + ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); blks = XFS_ADDAFORK_SPACE_RES(mp); diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 13cd4faa..99d53f93 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -1036,7 +1036,10 @@ xfs_bmap_add_attrfork( int error; /* error return value */ xfs_assert_ilocked(ip, XFS_ILOCK_EXCL); - ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); + if (xfs_is_metadir_inode(ip)) + ASSERT(XFS_IS_DQDETACHED(ip)); + else + ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); ASSERT(!xfs_inode_has_attr_fork(ip)); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);