btrfs-progs: check: change commit condition in fixup_extent_refs()
PATCH v2 1/1 btrfs-progs: check: change commit condition in fixup_extent_refs()
This patch fixes potential bugs in fixup_extent_refs(). If btrfs_start_transaction() fails in some way and returns error ptr, It goes to out logic. But old code checkes whether it is null and it calls commit. This patch solves the problem with make that it calls only if ret is no error.
Issue: #409
---
v2:
- Checks ret as well as trans
--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
check/main.c +1 -1
@@ -7735,7 +7735,7 @@ static int fixup_extent_refs(struct cache_tree *extent_cache, goto out; } out: -if (trans) { +if (!ret && !IS_ERR (trans)) {int err =btrfs_commit_transaction (trans, gfs_info->extent_root);if (!ret)
Signature · 1 line
2.25.1
Quoted 9 lines · Sidong Yang
This patch fixes potential bugs in
fixup_extent_refs(). Ifbtrfs_start_transaction()fails in some way and returns error ptr, It goes to out logic. But old code checkes whether it is null and it calls commit. This patch solves the problem with make that it calls only if ret is no error.Issue: #409
Signed-off-by Sidong Yang <[email protected]>
Quoted 21 lines
---
v2:
- Checks ret as well as trans--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)check/main.c +1
-1@@ -7735,7 +7735,7 @@ static int fixup_extent_refs(struct cache_tree *extent_cache, goto out; } out: -if (trans) { +if (!ret && !IS_ERR (trans)) {int err =btrfs_commit_transaction (trans, gfs_info->extent_root);if (!ret)
Quoted 9 lines · Sidong Yang
This patch fixes potential bugs in
fixup_extent_refs(). Ifbtrfs_start_transaction()fails in some way and returns error ptr, It goes to out logic. But old code checkes whether it is null and it calls commit. This patch solves the problem with make that it calls only if ret is no error.Issue: #409
Signed-off-by Sidong Yang <[email protected]>
Added to devel, thanks.