Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp505806pxx; Wed, 28 Oct 2020 09:52:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiaDX0CgAqZydBSFo+pPzxGf8f+efVhRahBNNBbyguI7YqgJZfr4fFGvStqdyOZEp1F5kL X-Received: by 2002:aa7:d781:: with SMTP id s1mr8565736edq.122.1603903920757; Wed, 28 Oct 2020 09:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603903920; cv=none; d=google.com; s=arc-20160816; b=E5lpyle51LitEHlfXrUrk4UhUnkDuO42hWBlYMzJ/Ut1Xw0/9MyGgO4YD+zG+SccoN AuEMpJITVZxaREgHvlZFid5iFORlrn1MDuYswPuXumjXs6dycKAJCnnX/Gms13l5UaqV ACPf9iNPODoUMQjF179AiSij3WILIFmp9vo2vL1EyT2nY1Z/XhUfajGdniRki+qz/aTG l2CZpRfF6fDCbhm7pMnAq38R1RrFSYTP9ZOMAsgU6+JHZLGhJFOtYFKu8RO7bOTl79Uj tlyTLLODLCrAtlM5jv4BTypxSqj+Tf0KjcH2c3dTef/ZC9WdGpeMyXn4/kLPJ/NfRgsT +j5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4TsWBFVNXvooE8G/awICu3JPZVrdCHlWt5INQrigKdo=; b=YbTlQTjkQa5zl0rNru6ihRk5qvSRF0i2ZVAENbHXzY3weZKnA3b2rP5YOjj+0faAeP Dp4Sf2r2EezoQ6AxhpH1FdQtJs30wVdM/vFrtg2i6nJmKt+XqGjoDE+Zwea8Nh12e8M7 8G2GyTeEhghhzIaTqtblX1oODoKhoC3mDulQDqJwXgPii7h/7u0psvgyP4BR1I2NWVo1 zAC/ZDInehYiGHfKSlRe8KdDQnWYlIRm3IPQ6jwUdVC/dsDMnfYbwpsRQ8UQDhoI7ufj bzVUacug5CRpRkFIk0OEgcc0F0ALkcDahzDisCSqtrS/ThFXncPqYGUge6uAk39c0dwV B6RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r2yV8YdP; 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 y1si30775edp.57.2020.10.28.09.51.37; Wed, 28 Oct 2020 09:52:00 -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=r2yV8YdP; 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 S1818799AbgJ0RXn (ORCPT + 99 others); Tue, 27 Oct 2020 13:23:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1780308AbgJ0Oyf (ORCPT ); Tue, 27 Oct 2020 10:54:35 -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 79FDC2071A; Tue, 27 Oct 2020 14:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810474; bh=C1bg0cciOruxIJ/Eufm0mlvebXwinxYTfSht2LQbe8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r2yV8YdPRtt+Q+ihuqfM5ttBNomujLqu5QcjI/m+B8W7V34zhFKnWUl79HCkm5NcK fXCEm4FDL7PrmZdgxp8Ca7YrOeFq5gGXKVBeVeJ4BHgIdcz6zcLO/JuGPGMlh2gH76 Z5CVx/jsP2bj4sgTYNv6bb9MkTFUgO/r+CPPfiaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 5.8 152/633] btrfs: add owner and fs_info to alloc_state io_tree Date: Tue, 27 Oct 2020 14:48:15 +0100 Message-Id: <20201027135529.827667815@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qu Wenruo [ Upstream commit 154f7cb86809a3a796bffbc7a5a7ce0dee585eaa ] Commit 1c11b63eff2a ("btrfs: replace pending/pinned chunks lists with io tree") introduced btrfs_device::alloc_state extent io tree, but it doesn't initialize the fs_info and owner member. This means the following features are not properly supported: - Fs owner report for insert_state() error Without fs_info initialized, although btrfs_err() won't panic, it won't output which fs is causing the error. - Wrong owner for trace events alloc_state will get the owner as pinned extents. Fix this by assiging proper fs_info and owner for btrfs_device::alloc_state. Fixes: 1c11b63eff2a ("btrfs: replace pending/pinned chunks lists with io tree") Reviewed-by: Nikolay Borisov Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent-io-tree.h | 1 + fs/btrfs/volumes.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/extent-io-tree.h b/fs/btrfs/extent-io-tree.h index 8bbb734f3f514..49384d55a908f 100644 --- a/fs/btrfs/extent-io-tree.h +++ b/fs/btrfs/extent-io-tree.h @@ -48,6 +48,7 @@ enum { IO_TREE_INODE_FILE_EXTENT, IO_TREE_LOG_CSUM_RANGE, IO_TREE_SELFTEST, + IO_TREE_DEVICE_ALLOC_STATE, }; struct extent_io_tree { diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 79e9a80bd37a0..f9d8bd3099488 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -406,7 +406,7 @@ void __exit btrfs_cleanup_fs_uuids(void) * Returned struct is not linked onto any lists and must be destroyed using * btrfs_free_device. */ -static struct btrfs_device *__alloc_device(void) +static struct btrfs_device *__alloc_device(struct btrfs_fs_info *fs_info) { struct btrfs_device *dev; @@ -433,7 +433,8 @@ static struct btrfs_device *__alloc_device(void) btrfs_device_data_ordered_init(dev); INIT_RADIX_TREE(&dev->reada_zones, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); INIT_RADIX_TREE(&dev->reada_extents, GFP_NOFS & ~__GFP_DIRECT_RECLAIM); - extent_io_tree_init(NULL, &dev->alloc_state, 0, NULL); + extent_io_tree_init(fs_info, &dev->alloc_state, + IO_TREE_DEVICE_ALLOC_STATE, NULL); return dev; } @@ -6545,7 +6546,7 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info, if (WARN_ON(!devid && !fs_info)) return ERR_PTR(-EINVAL); - dev = __alloc_device(); + dev = __alloc_device(fs_info); if (IS_ERR(dev)) return dev; -- 2.25.1