hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/btrfs/transaction.c
....@@ -301,10 +301,11 @@
301301 spin_unlock(&fs_info->trans_lock);
302302
303303 /*
304
- * If we are ATTACH, we just want to catch the current transaction,
305
- * and commit it. If there is no transaction, just return ENOENT.
304
+ * If we are ATTACH or TRANS_JOIN_NOSTART, we just want to catch the
305
+ * current transaction, and commit it. If there is no transaction, just
306
+ * return ENOENT.
306307 */
307
- if (type == TRANS_ATTACH)
308
+ if (type == TRANS_ATTACH || type == TRANS_JOIN_NOSTART)
308309 return -ENOENT;
309310
310311 /*
....@@ -821,8 +822,13 @@
821822
822823 trans = start_transaction(root, 0, TRANS_ATTACH,
823824 BTRFS_RESERVE_NO_FLUSH, true);
824
- if (trans == ERR_PTR(-ENOENT))
825
- btrfs_wait_for_commit(root->fs_info, 0);
825
+ if (trans == ERR_PTR(-ENOENT)) {
826
+ int ret;
827
+
828
+ ret = btrfs_wait_for_commit(root->fs_info, 0);
829
+ if (ret)
830
+ return ERR_PTR(ret);
831
+ }
826832
827833 return trans;
828834 }
....@@ -886,6 +892,7 @@
886892 }
887893
888894 wait_for_commit(cur_trans);
895
+ ret = cur_trans->aborted;
889896 btrfs_put_transaction(cur_trans);
890897 out:
891898 return ret;