xfs: use delete helper for items expected to be in AIL
authorBrian Foster <bfoster@redhat.com>
Wed, 6 May 2020 20:25:23 +0000 (13:25 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 7 May 2020 15:27:47 +0000 (08:27 -0700)
Various intent log items call xfs_trans_ail_remove() with a log I/O
error shutdown type, but this helper historically checks whether an
item is in the AIL before calling xfs_trans_ail_delete(). This means
the shutdown check is essentially a no-op for users of
xfs_trans_ail_remove().

It is possible that some items might not be AIL resident when the
AIL remove attempt occurs, but this should be isolated to cases
where the filesystem has already shutdown. For example, this
includes abort of the transaction committing the intent and I/O
error of the iclog buffer committing the intent to the log.
Therefore, update these callsites to use xfs_trans_ail_delete() to
provide AIL state validation for the common path of items being
released and removed when associated done items commit to the
physical log.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c

index 7768fb2b713577abe85d32a96a889a995d443567..17eb7cfad5d99530a922e3dd2d2351ef9fb4248f 100644 (file)
@@ -51,7 +51,7 @@ xfs_bui_release(
 {
        ASSERT(atomic_read(&buip->bui_refcount) > 0);
        if (atomic_dec_and_test(&buip->bui_refcount)) {
-               xfs_trans_ail_remove(&buip->bui_item, SHUTDOWN_LOG_IO_ERROR);
+               xfs_trans_ail_delete(&buip->bui_item, SHUTDOWN_LOG_IO_ERROR);
                xfs_bui_item_free(buip);
        }
 }
index c8cde4122a0fefc17399615b68324ff2b3d39e58..9809637fb84dc004dd17c2ea51581674cffbae38 100644 (file)
@@ -55,7 +55,7 @@ xfs_efi_release(
 {
        ASSERT(atomic_read(&efip->efi_refcount) > 0);
        if (atomic_dec_and_test(&efip->efi_refcount)) {
-               xfs_trans_ail_remove(&efip->efi_item, SHUTDOWN_LOG_IO_ERROR);
+               xfs_trans_ail_delete(&efip->efi_item, SHUTDOWN_LOG_IO_ERROR);
                xfs_efi_item_free(efip);
        }
 }
index 0316eab2fc3516154b5c975f01551ed5ea291efb..01bb77daeaeeeba54d94dc3e8d0aef1531487097 100644 (file)
@@ -50,7 +50,7 @@ xfs_cui_release(
 {
        ASSERT(atomic_read(&cuip->cui_refcount) > 0);
        if (atomic_dec_and_test(&cuip->cui_refcount)) {
-               xfs_trans_ail_remove(&cuip->cui_item, SHUTDOWN_LOG_IO_ERROR);
+               xfs_trans_ail_delete(&cuip->cui_item, SHUTDOWN_LOG_IO_ERROR);
                xfs_cui_item_free(cuip);
        }
 }
index e3bba2aec8682dd7a78426b8d1f513eec750f78e..fdb12b01b1781645d43bb043be31ca3874ff7230 100644 (file)
@@ -50,7 +50,7 @@ xfs_rui_release(
 {
        ASSERT(atomic_read(&ruip->rui_refcount) > 0);
        if (atomic_dec_and_test(&ruip->rui_refcount)) {
-               xfs_trans_ail_remove(&ruip->rui_item, SHUTDOWN_LOG_IO_ERROR);
+               xfs_trans_ail_delete(&ruip->rui_item, SHUTDOWN_LOG_IO_ERROR);
                xfs_rui_item_free(ruip);
        }
 }