]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: adjust xfs_bmap_add_attrfork for metadir
authorDarrick J. Wong <djwong@kernel.org>
Wed, 29 May 2024 04:11:02 +0000 (21:11 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:16 +0000 (17:13 -0700)
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.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 9e1cce5776b3dfbe3e317d396bf34efe78196000..f2450f8ace284b780ab3a34996b8b76fe1fc1761 100644 (file)
@@ -952,7 +952,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);
 
index 4b10f169f1eb941cfea336d63c9788bc4b90d2c9..141d2ee0b6a8e29737e63cf1ef7c715287d87b89 100644 (file)
@@ -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);