diff options
-rw-r--r-- | fs/btrfs/transaction.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 0ef29611fade..f15494699f3b 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -1575,6 +1575,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1575 | wait_event(cur_trans->writer_wait, | 1575 | wait_event(cur_trans->writer_wait, |
1576 | atomic_read(&cur_trans->num_writers) == 1); | 1576 | atomic_read(&cur_trans->num_writers) == 1); |
1577 | 1577 | ||
1578 | /* ->aborted might be set after the previous check, so check it */ | ||
1579 | if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { | ||
1580 | ret = cur_trans->aborted; | ||
1581 | goto cleanup_transaction; | ||
1582 | } | ||
1578 | /* | 1583 | /* |
1579 | * the reloc mutex makes sure that we stop | 1584 | * the reloc mutex makes sure that we stop |
1580 | * the balancing code from coming in and moving | 1585 | * the balancing code from coming in and moving |
@@ -1658,6 +1663,17 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
1658 | goto cleanup_transaction; | 1663 | goto cleanup_transaction; |
1659 | } | 1664 | } |
1660 | 1665 | ||
1666 | /* | ||
1667 | * The tasks which save the space cache and inode cache may also | ||
1668 | * update ->aborted, check it. | ||
1669 | */ | ||
1670 | if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { | ||
1671 | ret = cur_trans->aborted; | ||
1672 | mutex_unlock(&root->fs_info->tree_log_mutex); | ||
1673 | mutex_unlock(&root->fs_info->reloc_mutex); | ||
1674 | goto cleanup_transaction; | ||
1675 | } | ||
1676 | |||
1661 | btrfs_prepare_extent_commit(trans, root); | 1677 | btrfs_prepare_extent_commit(trans, root); |
1662 | 1678 | ||
1663 | cur_trans = root->fs_info->running_transaction; | 1679 | cur_trans = root->fs_info->running_transaction; |