Skip to content

Commit 94cd63a

Browse files
fdmananakdave
authored andcommitted
btrfs: add missing setup of log for full commit at add_conflicting_inode()
When logging conflicting inodes, if we reach the maximum limit of inodes, we return BTRFS_LOG_FORCE_COMMIT to force a transaction commit. However we don't mark the log for full commit (with btrfs_set_log_full_commit()), which means that once we leave the log transaction and before we commit the transaction, some other task may sync the log, which is incomplete as we have not logged all conflicting inodes, leading to some inconsistent in case that log ends up being replayed. So also call btrfs_set_log_full_commit() at add_conflicting_inode(). Fixes: e09d94c ("btrfs: log conflicting inodes without holding log mutex of the initial inode") CC: [email protected] # 6.1 Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 8bb6898 commit 94cd63a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5598,8 +5598,10 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans,
55985598
* LOG_INODE_EXISTS mode) and slow down other fsyncs or transaction
55995599
* commits.
56005600
*/
5601-
if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES)
5601+
if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) {
5602+
btrfs_set_log_full_commit(trans);
56025603
return BTRFS_LOG_FORCE_COMMIT;
5604+
}
56035605

56045606
inode = btrfs_iget(root->fs_info->sb, ino, root);
56055607
/*

0 commit comments

Comments
 (0)