xfs: whiteouts release intents that are not in the AIL
authorDave Chinner <dchinner@redhat.com>
Wed, 4 May 2022 01:46:47 +0000 (11:46 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 4 May 2022 01:46:47 +0000 (11:46 +1000)
When we release an intent that a whiteout applies to, it will not
have been committed to the journal and so won't be in the AIL. Hence
when we drop the last reference to the intent, we do not want to try
to remove it from the AIL as that will trigger a filesystem
shutdown. Hence make the removal of intents from the AIL conditional
on them actually being in the AIL so we do the correct thing.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.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 f05663fdb6ff55961b4106fc269b3d32dd9b4836..51f66e982484656cef3d4bda7b5c069f31d57cc3 100644 (file)
@@ -55,10 +55,11 @@ xfs_bui_release(
        struct xfs_bui_log_item *buip)
 {
        ASSERT(atomic_read(&buip->bui_refcount) > 0);
-       if (atomic_dec_and_test(&buip->bui_refcount)) {
-               xfs_trans_ail_delete(&buip->bui_item, SHUTDOWN_LOG_IO_ERROR);
-               xfs_bui_item_free(buip);
-       }
+       if (!atomic_dec_and_test(&buip->bui_refcount))
+               return;
+
+       xfs_trans_ail_delete(&buip->bui_item, 0);
+       xfs_bui_item_free(buip);
 }
 
 
index 032db5269e973c7e2e1bbf2751d8a3c2c959eb1b..765be054dffe6cbcaa37a940ca6bda23c6f6b8fa 100644 (file)
@@ -58,10 +58,11 @@ xfs_efi_release(
        struct xfs_efi_log_item *efip)
 {
        ASSERT(atomic_read(&efip->efi_refcount) > 0);
-       if (atomic_dec_and_test(&efip->efi_refcount)) {
-               xfs_trans_ail_delete(&efip->efi_item, SHUTDOWN_LOG_IO_ERROR);
-               xfs_efi_item_free(efip);
-       }
+       if (!atomic_dec_and_test(&efip->efi_refcount))
+               return;
+
+       xfs_trans_ail_delete(&efip->efi_item, 0);
+       xfs_efi_item_free(efip);
 }
 
 /*
index 57a025f5fd4bbd0b33f6cbdfa569640b37addcd6..7e97bf19793dfed86108e126def0c33a0634324e 100644 (file)
@@ -54,10 +54,11 @@ xfs_cui_release(
        struct xfs_cui_log_item *cuip)
 {
        ASSERT(atomic_read(&cuip->cui_refcount) > 0);
-       if (atomic_dec_and_test(&cuip->cui_refcount)) {
-               xfs_trans_ail_delete(&cuip->cui_item, SHUTDOWN_LOG_IO_ERROR);
-               xfs_cui_item_free(cuip);
-       }
+       if (!atomic_dec_and_test(&cuip->cui_refcount))
+               return;
+
+       xfs_trans_ail_delete(&cuip->cui_item, 0);
+       xfs_cui_item_free(cuip);
 }
 
 
index 1c7d8518cb4861e850ce7b021df5ffd8b6d15345..fef92e02f3bb6dda3694a669631ef6665fb17fd5 100644 (file)
@@ -54,10 +54,11 @@ xfs_rui_release(
        struct xfs_rui_log_item *ruip)
 {
        ASSERT(atomic_read(&ruip->rui_refcount) > 0);
-       if (atomic_dec_and_test(&ruip->rui_refcount)) {
-               xfs_trans_ail_delete(&ruip->rui_item, SHUTDOWN_LOG_IO_ERROR);
-               xfs_rui_item_free(ruip);
-       }
+       if (!atomic_dec_and_test(&ruip->rui_refcount))
+               return;
+
+       xfs_trans_ail_delete(&ruip->rui_item, 0);
+       xfs_rui_item_free(ruip);
 }
 
 STATIC void