X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=transaction.c;h=ad70572838c120c10f559b4a5f122d66ad66a759;hb=1d5058058a811a03a1985d18ff3071ce95b99c08;hp=6677a22081bcbebe5b9fcbec09341b718c855666;hpb=0ee0b57f0b7ebfa72a2525afeecc353fd74aca03;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/transaction.c b/transaction.c index 6677a22..ad70572 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) @@ -173,3 +179,7 @@ commit_tree: return 0; } +void btrfs_abort_transaction(struct btrfs_trans_handle *trans, int error) +{ + trans->fs_info->transaction_aborted = error; +}