]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: adjust xfs_bmap_add_attrfork for metadir
authorDarrick J. Wong <djwong@kernel.org>
Wed, 7 Aug 2024 22:54:17 +0000 (15:54 -0700)
committerChristoph Hellwig <hch@lst.de>
Sun, 22 Sep 2024 06:07:19 +0000 (08:07 +0200)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_attr.c
fs/xfs/libxfs/xfs_bmap.c

index f30bcc64100d56b7199fc6b73ee777f6a6e06aa9..4b7202e91b0ff0f74317e9354e19852f379dbe1e 100644 (file)
@@ -953,7 +953,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 bfc3155bb57d799d36354c401b17d0c0b3d95bb9..2cd9dc07dd1a06a179e83d6218a45e545b5f17da 100644 (file)
@@ -1042,7 +1042,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);