projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
btrfs-progs: check/lowmem: Fix the incorrect error message of check_extent_data_item
[platform/upstream/btrfs-progs.git]
/
transaction.c
diff --git
a/transaction.c
b/transaction.c
index
80aa7bc
..
ad70572
100644
(file)
--- 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);
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) {
if (!h)
return ERR_PTR(-ENOMEM);
if (root->commit_root) {
@@
-38,6
+41,7
@@
struct btrfs_trans_handle* btrfs_start_transaction(struct btrfs_root *root,
kfree(h);
return ERR_PTR(-EINVAL);
}
kfree(h);
return ERR_PTR(-EINVAL);
}
+ h->fs_info = fs_info;
fs_info->running_transaction = h;
fs_info->generation++;
h->transid = fs_info->generation;
fs_info->running_transaction = h;
fs_info->generation++;
h->transid = fs_info->generation;
@@
-140,6
+144,9
@@
int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
int ret = 0;
struct btrfs_fs_info *fs_info = root->fs_info;
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)
if (root->commit_root == root->node)
goto commit_tree;
if (root == root->fs_info->tree_root)
@@
-172,3
+179,7
@@
commit_tree:
return 0;
}
return 0;
}
+void btrfs_abort_transaction(struct btrfs_trans_handle *trans, int error)
+{
+ trans->fs_info->transaction_aborted = error;
+}