From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C71452590 for ; Sun, 22 Jan 2023 15:23:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FBB0C433D2; Sun, 22 Jan 2023 15:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1674401033; bh=Z3v8u28F2/rDFaLHq5E8JDJeqSMGVvL1mmRi8hKsLNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wKsLPmafW/Xw8PhwElmcBb9n/Xcj6Mu7POnYuzqhX0NgfUXzGpVUFkILuWBtgcuQ4 G5+3j7SXmXSwTUJlHLlW8Ju21pXdmMw9EHnkqrT+7IQ6rny6GMcNQ6rG/RgX3RnQXI r50t4C8Snop0UEgRJpEwtxA7jVfTDntm83y6WYpg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , Filipe Manana , David Sterba Subject: [PATCH 6.1 084/193] btrfs: add missing setup of log for full commit at add_conflicting_inode() Date: Sun, 22 Jan 2023 16:03:33 +0100 Message-Id: <20230122150250.226938729@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230122150246.321043584@linuxfoundation.org> References: <20230122150246.321043584@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Filipe Manana commit 94cd63ae679973edeb5ea95ec25a54467c3e54c8 upstream. 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: e09d94c9e448 ("btrfs: log conflicting inodes without holding log mutex of the initial inode") CC: stable@vger.kernel.org # 6.1 Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -5626,8 +5626,10 @@ static int add_conflicting_inode(struct * LOG_INODE_EXISTS mode) and slow down other fsyncs or transaction * commits. */ - if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) + if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) { + btrfs_set_log_full_commit(trans); return BTRFS_LOG_FORCE_COMMIT; + } inode = btrfs_iget(root->fs_info->sb, ino, root); /*