diff mbox series

[5/8] btrfs: do not abort transaction on failure to update log root

Message ID 937c64018b104e83fa8d26a1c54ae67eeb5806a4.1673361215.git.fdmanana@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs: some log tree fixes and cleanups | expand

Commit Message

Filipe Manana Jan. 10, 2023, 2:56 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

When syncing a log, if we fail to update a log root in the log root tree,
we are aborting the transaction if the failure was not -ENOSPC. This is
excessive because there is a chance that a transaction commit can succeed,
and therefore avoid to turn the filesystem into RO mode. All we need to be
careful about is to mark the log for a full commit, which we already do,
to make sure no one commits a super block pointing to an oudated log root

So don't abort the transaction if we fail to update a log root in the log
root tree, and log an error if the failure is not -ENOSPC, so that it does
not go completely unnoticed.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
 fs/btrfs/tree-log.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
diff mbox series


diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 1f70d4ebffae..d43261545264 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3044,15 +3044,12 @@  int btrfs_sync_log(struct btrfs_trans_handle *trans,
-		if (ret != -ENOSPC) {
-			btrfs_abort_transaction(trans, ret);
-			mutex_unlock(&log_root_tree->log_mutex);
-			goto out;
-		}
+		if (ret != -ENOSPC)
+			btrfs_err(fs_info,
+				  "failed to update log for root %llu ret %d",
+				  root->root_key.objectid, ret);
 		btrfs_wait_tree_log_extents(log, mark);
 		goto out;