]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: adjust xfs_bmap_add_attrfork for metadir
authorDarrick J. Wong <djwong@kernel.org>
Mon, 25 Nov 2024 21:14:18 +0000 (13:14 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 24 Dec 2024 02:01:25 +0000 (18:01 -0800)
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_attr.c
libxfs/xfs_bmap.c

index 150aaddf7f9fedf13a24e9cb058582d0ab2ab2e8..7567014abbe7f0cedb8a0314836dcbad2893bd1b 100644 (file)
@@ -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);
 
index 13cd4faa49283863cb8edd01ac89af3416abc6a3..99d53f9383a49abdf5d812e4ba9f587152a63c45 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);