]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: remove bp->b_error check in xfs_attr3_root_inactive
authorLong Li <leo.lilong@huawei.com>
Mon, 23 Dec 2024 11:45:11 +0000 (19:45 +0800)
committerCarlos Maiolino <cem@kernel.org>
Thu, 9 Jan 2025 09:36:23 +0000 (10:36 +0100)
The b_error check right after xfs_trans_get_buf() is redundant:

1) If the buffer is found in transaction via xfs_trans_buf_item_match(),
   any corrupted metadata error would have already been exposed during
   previous reads like xfs_da3_node_read().

2) If the buffer is obtained via xfs_buf_get_map():
   - It's called without XBF_READ flag, so won't return buffer with
     b_error set, since xfs_buf_get_map() will clear it anyway.
   - Buffer found in cache normally won't have error since previous reads
     had checked it, unless someone corrupts the buffer and the AIL
     pushes it out to disk while the buffer's unlocked. But in this case,
     AIL will shut down the log.

Remove this redundant check to simplify the code, make the code consistent
with most other xfs_trans_get_buf() callers in XFS.

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_attr_inactive.c

index 24fb12986a568acbe0f4d4785305e706bec5217c..319004bf089fa35982386e28d1ab315626daa5b8 100644 (file)
@@ -305,11 +305,6 @@ xfs_attr3_root_inactive(
                        XFS_FSB_TO_BB(mp, mp->m_attr_geo->fsbcount), 0, &bp);
        if (error)
                return error;
-       error = bp->b_error;
-       if (error) {
-               xfs_trans_brelse(*trans, bp);
-               return error;
-       }
        xfs_trans_binval(*trans, bp);   /* remove from cache */
        /*
         * Commit the invalidate and start the next transaction.