diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-02-05 19:04:03 +0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-05 19:04:03 +0400 |
commit | 0e4e02636611dbf89a2f36320a32054f9936d6cb (patch) | |
tree | 18b4ecc6c3812770b29729d7abbdc673ffd73a41 /fs/btrfs/transaction.c | |
parent | 1f0905ec156eec8f12cd593bc564551770319720 (diff) | |
parent | 1eafa6c73791e4f312324ddad9cbcaf6a1b6052b (diff) | |
download | linux-0e4e02636611dbf89a2f36320a32054f9936d6cb.tar.xz |
Merge branch 'for-linus' into raid56-experimental
Conflicts:
fs/btrfs/volumes.c
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 1e7f176bd211..c56b9d436204 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1475,7 +1475,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, goto cleanup_transaction; } - if (cur_trans->aborted) { + /* Stop the commit early if ->aborted is set */ + if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { ret = cur_trans->aborted; goto cleanup_transaction; } @@ -1581,6 +1582,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, wait_event(cur_trans->writer_wait, atomic_read(&cur_trans->num_writers) == 1); + /* ->aborted might be set after the previous check, so check it */ + if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { + ret = cur_trans->aborted; + goto cleanup_transaction; + } /* * the reloc mutex makes sure that we stop * the balancing code from coming in and moving @@ -1664,6 +1670,17 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, goto cleanup_transaction; } + /* + * The tasks which save the space cache and inode cache may also + * update ->aborted, check it. + */ + if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { + ret = cur_trans->aborted; + mutex_unlock(&root->fs_info->tree_log_mutex); + mutex_unlock(&root->fs_info->reloc_mutex); + goto cleanup_transaction; + } + btrfs_prepare_extent_commit(trans, root); cur_trans = root->fs_info->running_transaction; |