summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-08-29 14:55:37 +0200
committerDavid Sterba <dsterba@suse.com>2017-09-08 16:15:05 +0200
commit72fbe845d4fdd063260a6a43ac0b27cd43b0e301 (patch)
tree3c336e5c70073e229f91adf1ff6ed491b32c73fa
parent355a052647e3a3bab49dfea3f0281f0d5efae4ae (diff)
btrfs-progs: don't start or commit after transaction abort
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--transaction.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/transaction.c b/transaction.c
index feca06b4..ad705728 100644
--- a/transaction.c
+++ b/transaction.c
@@ -26,6 +26,9 @@ struct btrfs_trans_handle* btrfs_start_transaction(struct btrfs_root *root,
struct btrfs_fs_info *fs_info = root->fs_info;
struct btrfs_trans_handle *h = kzalloc(sizeof(*h), GFP_NOFS);
+ if (fs_info->transaction_aborted)
+ return ERR_PTR(-EROFS);
+
if (!h)
return ERR_PTR(-ENOMEM);
if (root->commit_root) {
@@ -141,6 +144,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
int ret = 0;
struct btrfs_fs_info *fs_info = root->fs_info;
+ if (trans->fs_info->transaction_aborted)
+ return -EROFS;
+
if (root->commit_root == root->node)
goto commit_tree;
if (root == root->fs_info->tree_root)