Skip to content

Commit 09e4486

Browse files
fdmananakdave
authored andcommitted
btrfs: do not abort transaction on failure to update log root
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 outdated log root tree. 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. CC: [email protected] # 6.0+ Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 16199ad commit 09e4486

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/btrfs/tree-log.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,15 +3044,12 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
30443044

30453045
blk_finish_plug(&plug);
30463046
btrfs_set_log_full_commit(trans);
3047-
3048-
if (ret != -ENOSPC) {
3049-
btrfs_abort_transaction(trans, ret);
3050-
mutex_unlock(&log_root_tree->log_mutex);
3051-
goto out;
3052-
}
3047+
if (ret != -ENOSPC)
3048+
btrfs_err(fs_info,
3049+
"failed to update log for root %llu ret %d",
3050+
root->root_key.objectid, ret);
30533051
btrfs_wait_tree_log_extents(log, mark);
30543052
mutex_unlock(&log_root_tree->log_mutex);
3055-
ret = BTRFS_LOG_FORCE_COMMIT;
30563053
goto out;
30573054
}
30583055

0 commit comments

Comments
 (0)