Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4159167pxk; Tue, 8 Sep 2020 12:11:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfiucIxOKPgysFfNQfSJidzCSf5stXWH/IPEOWEpYREQZs1iWacFQQUVJ3U8tEjRMbCEYx X-Received: by 2002:a17:907:2456:: with SMTP id yw22mr26702549ejb.337.1599592281418; Tue, 08 Sep 2020 12:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599592281; cv=none; d=google.com; s=arc-20160816; b=NiWj9OfCT8XDe5T/xKPrn/9oKEScCJomUz3jn5+V0RvXyOwoPvE+HncSNEOqmkoD/p JL+AJjSGcnZEAAlYt9xfJUYPl7mCfJYSs5oZLPr37qojK+1T4HmOWFrcd002ACuH2MpB 4LrMQHvSSWIpzH4YH8HVspXUZ7sR19dBYCmCC+E7jQWeDd8uTo3wB0ZG9WcjYxiCatH6 gost96dg11v8jh9gdBEXevklpldYqALkqK5QgQPx5rws/d+Y70X3tDnVFBsXQOMNNj9B SnB0M3n2enRzrMhAOR1H0vTqv2Or4ybMw48tu4BosDBn8L/1mVCBeGejDHJ+bFTsH4l/ 8rTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+HkOpEBk+F/p6+fkQRiEMs+mhrAISyFQDN282Y7lDoo=; b=cpjBxpGtoxezk8GvWHbo2mIivsnlJB4zXe2Sc+/7pmxeGNvuUJHhIouwsiV1aIH/c8 FaBo77wnXDyZdMiimfik6R35WQy44qtucVWUJqUU5yy5RdrUm4rDXm0il0jNa+1FXmxN WEGhy10A2uF/QiNeFaRr6fzavdoaPG8YtxDuHSvn7iI4Ycyb7tHeRxWFGYLLQkoJqWRr GKLuEuNoV9vuKym9tNbKUe99ZGCLV9CyS1X8He15uhWl6Qn2RoMOsAmQ2reR3z/IHNVu BfIXcM+Xkj9InePgpBohQLlMigVMRPPWn1tZvj4akBondEB/SwRjchmj/G0sIgE41ntR 4ukQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SXv8Hk1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si12396361ejz.238.2020.09.08.12.10.58; Tue, 08 Sep 2020 12:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SXv8Hk1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731748AbgIHTJS (ORCPT + 99 others); Tue, 8 Sep 2020 15:09:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731241AbgIHQGG (ORCPT ); Tue, 8 Sep 2020 12:06:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BD16623D97; Tue, 8 Sep 2020 15:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599579983; bh=YmEHi+GZhYZlb4S1hR8Hui+LW2rAkyoIkqRRDUul3FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXv8Hk1yiBwfemwo2zt0pRel/MBCdZMBJhOYNsqwGt1+di/KULOT32PSUNF1G2OIj L/HyXnAdpPKzhhGQ8CsHgmZX7wuEnbrzbL4iffwz348KY+4/qnfplMgycs30VCQym6 uUu7XRwXLsaGphsc6kgwBgZ+1Pjq+OwWP6srsyb8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Nikolay Borisov , Josef Bacik , David Sterba Subject: [PATCH 5.4 083/129] btrfs: set the correct lockdep class for new nodes Date: Tue, 8 Sep 2020 17:25:24 +0200 Message-Id: <20200908152233.845059178@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152229.689878733@linuxfoundation.org> References: <20200908152229.689878733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik commit ad24466588ab7d7c879053c5afd919b0c555fec0 upstream. When flipping over to the rw_semaphore I noticed I'd get a lockdep splat in replace_path(), which is weird because we're swapping the reloc root with the actual target root. Turns out this is because we're using the root->root_key.objectid as the root id for the newly allocated tree block when setting the lockdep class, however we need to be using the actual owner of this new block, which is saved in owner. The affected path is through btrfs_copy_root as all other callers of btrfs_alloc_tree_block (which calls init_new_buffer) have root_objectid == root->root_key.objectid . CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Filipe Manana Reviewed-by: Nikolay Borisov Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4446,7 +4446,7 @@ btrfs_init_new_buffer(struct btrfs_trans return ERR_PTR(-EUCLEAN); } - btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); + btrfs_set_buffer_lockdep_class(owner, buf, level); btrfs_tree_lock(buf); btrfs_clean_tree_block(buf); clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);