From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60367C3F2CD for ; Mon, 23 Mar 2020 14:43:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 322212072E for ; Mon, 23 Mar 2020 14:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584974591; bh=Lo+ohDtEoWEShbT1n018bbBgj/s8mHrHaUbU8p0E5LI=; h=Subject:To:Cc:From:Date:List-ID:From; b=cgbm/3+wwv45LKwgrpXbOeDLCizTbm2wGpBJf2MC+LYJVFwD9WTbEdl+zvjTwLno1 R9i2mrUKrvdc11Ead12JrzrslXIwnq3x8NR6le9ww5oEb+n3U6bfW0WSgAeIv6wb/h s8kx9U4K2WnJklUNVQRdvDisrhlP65XLerjCKhgY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726141AbgCWOnK (ORCPT ); Mon, 23 Mar 2020 10:43:10 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:55075 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbgCWOnK (ORCPT ); Mon, 23 Mar 2020 10:43:10 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 78EB0574; Mon, 23 Mar 2020 10:43:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 23 Mar 2020 10:43:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=hRLAGn 2YCrDwn9RJJwumehHvr4N6XFHG8bl0FpowKSA=; b=dhsgZpSwYm0tcWo/AIDCLm 8OKm0syeU2PjkfR4JaUO5iZRs3WfFICHOjfJZtSpiKJMlmD+kBJfIihOjoQETsYw jJBYHOL/Y3VGioAZhXkj9zXsPH5TifRBWBSyhZvQFqMUD8Jv9By0ctyceZKgY8BU xcuGxEs2P1o7q2YT2GADebNexAsFdboTkyqZZLMIAF1WyWQvXxHeUI7IEL3q6n/l t1HXnqA/N8HhgXnTDDD0Tp7xaSsCb4ZpExBYea+yPkywTumnvWgG5T+fUpgPoNsE GHZKMsP29JyO+2GWWqbsId2k5TWAWhEFCy3YzPuXAMc6LE0EiaXBjSFfSgzhdNXA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegkedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id B96E83280064; Mon, 23 Mar 2020 10:43:08 -0400 (EDT) Subject: FAILED: patch "[PATCH] btrfs: fix log context list corruption after rename whiteout" failed to apply to 4.14-stable tree To: fdmanana@suse.com, dsterba@suse.com Cc: From: Date: Mon, 23 Mar 2020 15:43:02 +0100 Message-ID: <1584974582132143@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 236ebc20d9afc5e9ff52f3cf3f365a91583aac10 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Tue, 10 Mar 2020 12:13:53 +0000 Subject: [PATCH] btrfs: fix log context list corruption after rename whiteout error During a rename whiteout, if btrfs_whiteout_for_rename() returns an error we can end up returning from btrfs_rename() with the log context object still in the root's log context list - this happens if 'sync_log' was set to true before we called btrfs_whiteout_for_rename() and it is dangerous because we end up with a corrupt linked list (root->log_ctxs) as the log context object was allocated on the stack. After btrfs_rename() returns, any task that is running btrfs_sync_log() concurrently can end up crashing because that linked list is traversed by btrfs_sync_log() (through btrfs_remove_all_log_ctxs()). That results in the same issue that commit e6c617102c7e4 ("Btrfs: fix log context list corruption after rename exchange operation") fixed. Fixes: d4682ba03ef618 ("Btrfs: sync log after logging new name") CC: stable@vger.kernel.org # 4.19+ Signed-off-by: Filipe Manana Signed-off-by: David Sterba diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 27076ebadb36..d267eb5caa7b 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -9496,6 +9496,10 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, ret = btrfs_sync_log(trans, BTRFS_I(old_inode)->root, &ctx); if (ret) commit_transaction = true; + } else if (sync_log) { + mutex_lock(&root->log_mutex); + list_del(&ctx.list); + mutex_unlock(&root->log_mutex); } if (commit_transaction) { ret = btrfs_commit_transaction(trans);