public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: abort transaction in do_remap_reloc_trans() on failure
@ 2026-04-07 16:16 Mark Harmstone
  2026-04-07 21:31 ` Boris Burkov
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Harmstone @ 2026-04-07 16:16 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Mark Harmstone

If one of the calls made by do_remap_reloc_trans() fails, we can leave
the remap tree in an inconsistent state. Abort the transaction if this
happens, to prevent the corrupt state from reaching the disk.

Signed-off-by: Mark Harmstone <mark@harmstone.com>
---
 fs/btrfs/relocation.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 1c42c5180bddd5..277a0042967665 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -5089,6 +5089,7 @@ static int do_remap_reloc_trans(struct btrfs_fs_info *fs_info,
 	btrfs_free_reserved_extent(fs_info, new_addr, length, 0);
 
 	mutex_unlock(&fs_info->remap_mutex);
+	btrfs_abort_transaction(trans, ret);
 	btrfs_end_transaction(trans);
 
 	return ret;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-08 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 16:16 [PATCH] btrfs: abort transaction in do_remap_reloc_trans() on failure Mark Harmstone
2026-04-07 21:31 ` Boris Burkov
2026-04-08 16:59   ` Mark Harmstone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox