Thread (7 messages) 7 messages, 3 authors, 2021-05-21

Re: [PATCH 2/2] btrfs: return errors from btrfs_del_csums in cleanup_ref_head

From: Qu Wenruo <hidden>
Date: 2021-05-20 01:02:53


On 2021/5/19 下午10:52, Josef Bacik wrote:
We are unconditionally returning 0 in cleanup_ref_head, despite the fact
that btrfs_del_csums could fail.  We need to return the error so the
transaction gets aborted properly, fix this by returning ret from
btrfs_del_csums in cleanup_ref_head.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <redacted>

Thanks,
Qu
quoted hunk ↗ jump to hunk
---
  fs/btrfs/extent-tree.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index b84bbc24ff57..790de24576ac 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1826,7 +1826,7 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans,

  	struct btrfs_fs_info *fs_info = trans->fs_info;
  	struct btrfs_delayed_ref_root *delayed_refs;
-	int ret;
+	int ret = 0;

  	delayed_refs = &trans->transaction->delayed_refs;
@@ -1868,7 +1868,7 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans,
  	trace_run_delayed_ref_head(fs_info, head, 0);
  	btrfs_delayed_ref_unlock(head);
  	btrfs_put_delayed_ref_head(head);
-	return 0;
+	return ret;
  }

  static struct btrfs_delayed_ref_head *btrfs_obtain_ref_head(
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help