From patchwork Tue Jul 30 10:33:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13747228 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F8A619FA62; Tue, 30 Jul 2024 10:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335607; cv=none; b=o/qpmFBXS9eOmZZeHZfyl08vY0IaQN42k7HN0HmY5VYUblggd2kym3s4QxsU+IjEYX4iK+I9a4nDlS64XjyI95tu+nyO8AH80mHI/a69BXQQkPGes9xvp6fCdY8jc9ldDCuUfvD8E6+v+qwNbnWzWGVc4+Wr1ImhtZ8FgNol7Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335607; c=relaxed/simple; bh=7z9b6DSEEd3AS7TAf2EEFdpb8JBFUBPJjjKwMcTk1bM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t4pYLIjNDZ4KaPHBO/Tm4va9MatW/YMzjURcozT+iseOA9h4vjOjAep/ibFPMHfte5E+nZdRItErkOnNE68v2zi/5PSM3pfiahtTlxo2ssRMABzkxcMgwGIE6Ylgmaz9Kr90QmCsy/TC2ehpOSpSGG+gLpWKa5lc3/xa5WWjmMk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a7a843bef98so464229266b.2; Tue, 30 Jul 2024 03:33:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722335604; x=1722940404; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zGN/kk6WdhdWkkFKRFXP8WuazD2BEVj2C7KF2uk7+UY=; b=Rmp6JLA3lgoi3mQ4DTGOEqygYkcZC6Ctjx88n4ZsB1iiju/MTQj0xin0+VWazdpnj+ eRSbzPwp+mIYZQ9pDmv/3e2sSoS4dUSkZIA9ldlXtDh6CHoFyaRMwxUoxHDgtKLRsIql me98y9DAQMwyQ58hJjz/pjcF9bB8iPalMALNcV5u0M68g+i5IU7Owyq2XKpn7GWuhzF+ yLSphF1/L5Ll8C7ouqJhT+d7P3WS2NJmE/RmDYvL5tyylpsK3H4JYtNKOXHRzSEMjRGO EQinUHeyhf9+pLDXpf+q7xXVNa/KHFCZYZ2UGVuX3r2rRV4lDki85DJvzCHN5ZHGO5fK ns2A== X-Forwarded-Encrypted: i=1; AJvYcCXWZMOcckICKwNPMqNEmsXtFFv12une/c0BI+sr3G7tNp1Cu3m4HrBsiGYWqki3b0vSdVDTs6n4t7jQ+RMKdkj0hRDNJhFIEHlDwUYR X-Gm-Message-State: AOJu0YzToy18KQxNYglZQgxDGM/BbNoAL9FZiPS1Vw646W/8RzDlagQm IHRObpRNt+jDIpPVeywAq8T5Nhqs3KmJiTDGG3Bpm8nnoJ910g7k X-Google-Smtp-Source: AGHT+IESzVqZNqfmZoIANQuHqgZPH/KQSQXGGHUJ/ihImO6iwUaVNrC+1PzEjwZRBusdqCd4R7u2Ow== X-Received: by 2002:a17:907:3f1e:b0:a7a:be06:d8dc with SMTP id a640c23a62f3a-a7d40165fcemr862127366b.48.1722335603460; Tue, 30 Jul 2024 03:33:23 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f732f200fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f732:f200:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acadb9f60sm622455266b.223.2024.07.30.03.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 03:33:23 -0700 (PDT) From: Johannes Thumshirn Date: Tue, 30 Jul 2024 12:33:14 +0200 Subject: [PATCH v2 1/5] btrfs: don't dump stripe-tree on lookup error Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-debug-v2-1-38e6607ecba6@kernel.org> References: <20240730-debug-v2-0-38e6607ecba6@kernel.org> In-Reply-To: <20240730-debug-v2-0-38e6607ecba6@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=859; i=jth@kernel.org; h=from:subject:message-id; bh=hwc/5qBk/m03Fn+onMcecnGBzxZqVF2km5Mrm9HY6u4=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaStOFiQ9vxP6v6UtIv79+TODL7AOfGJlkzIjCeVXV4mW elPL6661VHKwiDGxSArpshyPNR2v4TpEfYph16bwcxhZQIZwsDFKQATiedhZGhnua8cevpzq4n7 e+WF/85J2p8w81P85X5Q+t2DfcJhz/4yMky/e/zvvL3Npkui+fWKY1YY6bvrFjyYl7dF6/mzH9e niPMAAA== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn This just creates unnecessary noise and doesn't provide any insights into debugging RAID stripe-tree related issues. Signed-off-by: Johannes Thumshirn --- fs/btrfs/raid-stripe-tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 684d4744f02d..97430918e923 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -284,8 +284,6 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, if (ret > 0) ret = -ENOENT; if (ret && ret != -EIO && !stripe->is_scrub) { - if (IS_ENABLED(CONFIG_BTRFS_DEBUG)) - btrfs_print_tree(leaf, 1); btrfs_err(fs_info, "cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s", logical, logical + *length, stripe->dev->devid, From patchwork Tue Jul 30 10:33:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13747229 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E62E1A0AE5; Tue, 30 Jul 2024 10:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335607; cv=none; b=lSsEXma9HXXOj+26bLa7Y5Kzd/l7uFPbP3ywBsg9l5pCt9PvL6XcctHApqhSpie3tN7ZYUYj6wPA4EGfBHfbh3+rIYf4+mG5wRFFDRttLjPJ4KcT9XtWLO5Q6M0k9ebV6696ApVKZUsXO3hkMABQapXZuYB67suPSLuK6FB2U+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335607; c=relaxed/simple; bh=V2/wyFM3bPaGJfPQmLX/sluxJRKr7lvIOzPidOT0y/U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ft/oVN3J58nBOviqCLbiWbo09yG7zCB3l8iUrIE3gwhJYVGnSz7S9fk7/pAtcTPEGXH6Db+EK4mtrhOx4jDKaIvBMNuWKJb51IRqnREccr+D6i9RPIZ0z6xWHwEPCGGEcxPaMLQ5lRKmOQTiOEooeTj+6GiDDT3hDnoa38C4zU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a7a975fb47eso622439466b.3; Tue, 30 Jul 2024 03:33:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722335604; x=1722940404; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3LuI4Ztw0QlpRT70UGqlhNtTpM0k62lG+oH/v547owU=; b=sRQEWgFDl3c6QBa5jbB6ZocBEzXAdoDaplt3rqnzmI6VbBE7Fe/I8mas6BwFm+Icjg XNP45Mlk+U0+CIJOCbZg8Y7hdWXTqfUeqaWzWo3eb4+aNvmWZdA8V49F6CAACxt+1AIP wZPdFKHowf6r2+BN51gxZfGUqyKCob+iN2RWg/R9/B8kseoEB6UoNGZWmRPumxjVCNKH BaH+4bIfS8u/UYFHpuzalrGn0ezFeifZpwzhY/Y2py/1aQdh1F+oeERjrEaCFG95VWrJ VvjyvBrlKCvYW6MfjczSDMHlzBSKV3sH/Z1NpXMV3PgiPrD/gdL1peMun7V0VcbDPGSI EQIQ== X-Forwarded-Encrypted: i=1; AJvYcCXidf0BKhIsOJcEQmIzFEf5ctk8vgh/fw1wh9uJTGJGNrbY5MVIhR6sS3KCeSiRnj3rkWDaUp5VTimbL02k8dAgWZs2ggkmoG30xobQ X-Gm-Message-State: AOJu0Ywj/Um1zc0gNJ4X1JHgPN41bIuHMFKTEy6OlszDVyZHnOv/IyrX eVlaJIcUme8o+mEZI1DIStlTbyM2AT2Z1QbFAOwsd0FrOLZGbn7I X-Google-Smtp-Source: AGHT+IEYJ0VWlY56L8QNbD6O92hAt0RYIujcd+d1NYHdaz9lZuzhMKyHU5MdFp3T+WJ6UxRBvMxwGg== X-Received: by 2002:a17:906:dc95:b0:a7a:ae85:f245 with SMTP id a640c23a62f3a-a7d400e1eddmr754454566b.38.1722335604423; Tue, 30 Jul 2024 03:33:24 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f732f200fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f732:f200:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acadb9f60sm622455266b.223.2024.07.30.03.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 03:33:24 -0700 (PDT) From: Johannes Thumshirn Date: Tue, 30 Jul 2024 12:33:15 +0200 Subject: [PATCH v2 2/5] btrfs: rename btrfs_io_stripe::is_scrub to rst_search_commit_root Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-debug-v2-2-38e6607ecba6@kernel.org> References: <20240730-debug-v2-0-38e6607ecba6@kernel.org> In-Reply-To: <20240730-debug-v2-0-38e6607ecba6@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2799; i=jth@kernel.org; h=from:subject:message-id; bh=GLCvjYyujrbk7qMrFGW/JRXoGw+aEQQjKxibIwWDeQ4=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaStOFhg/aNZZspC952b5RZLzRPwP+LIcvXo/tr4gOsRp TqO1i4xHaUsDGJcDLJiiizHQ233S5geYZ9y6LUZzBxWJpAhDFycAjCRUkmGvyIH2rxuVa5OSXY6 upGz/cbMRVuUxfaYztpXplmTfG1ypRjD/wL+v5Lt9beePmRkDDFO45LU3xT4cHFUx/+3k2ZpijE X8AIA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Rename 'btrfs_io_stripe::is_scrub' to 'rst_search_commit_root'. While 'is_scrub' describes the state of the io_stripe (it is a stripe submitted by scrub) it does not describe the purpose, namely looking at the commit root when searching RAID stripe-tree entries. Renaming the stripe to rst_search_commit_root describes this purpose. Signed-off-by: Johannes Thumshirn --- fs/btrfs/bio.c | 2 +- fs/btrfs/raid-stripe-tree.c | 4 ++-- fs/btrfs/scrub.c | 2 +- fs/btrfs/volumes.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index f04d93109960..dfb32f7d3fc2 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -679,7 +679,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num) blk_status_t ret; int error; - smap.is_scrub = !bbio->inode; + smap.rst_search_commit_root = !bbio->inode; btrfs_bio_counter_inc_blocked(fs_info); error = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length, diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 97430918e923..bfb567f602b1 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -210,7 +210,7 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, if (!path) return -ENOMEM; - if (stripe->is_scrub) { + if (stripe->rst_search_commit_root) { path->skip_locking = 1; path->search_commit_root = 1; } @@ -283,7 +283,7 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, out: if (ret > 0) ret = -ENOENT; - if (ret && ret != -EIO && !stripe->is_scrub) { + if (ret && ret != -EIO && !stripe->rst_search_commit_root) { btrfs_err(fs_info, "cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s", logical, logical + *length, stripe->dev->devid, diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 0f15f5139896..a1f41e8b00cd 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1695,7 +1695,7 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx, (i << fs_info->sectorsize_bits); int err; - io_stripe.is_scrub = true; + io_stripe.rst_search_commit_root = true; stripe_len = (nr_sectors - i) << fs_info->sectorsize_bits; /* * For RST cases, we need to manually split the bbio to diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index c947187539dd..03d2d60afe0c 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -444,7 +444,7 @@ struct btrfs_io_stripe { /* Block mapping. */ u64 physical; u64 length; - bool is_scrub; + bool rst_search_commit_root; /* For the endio handler. */ struct btrfs_io_context *bioc; }; From patchwork Tue Jul 30 10:33:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13747230 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17AC91A0AFE; Tue, 30 Jul 2024 10:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335608; cv=none; b=GwPQmm42r2adUkjWe1UtGk/DCNrs0Heikkb/d12Hg0XSN+48HSeQz0W5QjPhN8WeJCQQBUrrm1t6/tAlP1NfDzgs1OtRinJLyDWUasq+RwQkdHYev/zXMXYrAKX58WkQhneKmZgb+K3Yn/ppGAdj7xpos50wV+VQ0xdne7e6T58= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335608; c=relaxed/simple; bh=/IcSJYYXJNCnwyGW/xg7CQHiY002W+thsnUAs/eIUL4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CRdBG1efAOHqnmGfFsinmRFjcQpnD4I3AKrAnL0qmp3Jot3EASZj9YaFLrauyZwfrTCug0h9JnjgNtS8GCIRgXJnUN4l5VF2rvTPvRIoRg7uYKaeFDyP4ZT0sv/IuzK0kJGOMnPsaT9fdWJyUuS95z912m00C5y5bgXiI0ri600= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a7a9185e1c0so417485366b.1; Tue, 30 Jul 2024 03:33:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722335605; x=1722940405; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WJWlRDxSJTNdG19sMCqs4ElfI/UMNfe1NBY5LQ2S1jo=; b=gFG+0GC6YuyOUaX9O7Ji3IYayl2UFPW0UNMkHoSvKs59kLXDfQfQMi7F++bDr07Sje sPeoRIzTE4nes/+zsHGY0YTVX2Qyijkfu4HD2tvxwkCGO6JOdwZAlDuMJ+/7xZCBeTuk F674XfklTTIYqj3FWxcOht22/Vi+QWeR4PSf2oVlw48chrKEzm0RjoH47d/GziUt8V+S ORJZ6KaaQ4eIE6Ket3o7Uebdo4V4VhoxCdD/xYlKNXpXgvnqYP0z4vcnGCwOMwh8AlPG 9bWdAFeszTvdJ98i83BT5DZQcX965OqSDcT1ubXThAJKo9eTvZtQjEqV6HkFYSaC8m01 uVAg== X-Forwarded-Encrypted: i=1; AJvYcCXLTBssChbgHtfP89keynryyj9sfSRXwHFrOF4oIaASskY/nMz3/NtYrHx77tDDJls6EuzG7oges999X+HFD5Y8L5qjY5IuGz0f1FxD X-Gm-Message-State: AOJu0YzoOyJMmbiYgsrLxLTJhW4tCuGkEjWA81tPjTK/tVYVYDcRffU0 TSLW4Zb5NlKMPwC9X3Cuar0XdTjK8KGsDVT9bVxskII4D58YE2WASgosSw== X-Google-Smtp-Source: AGHT+IGz8vrwXgYDFNl6r0Cv/OnPdHKZoCpNEXptSTywro3ZWzR0pul4eNhh7t6g7yA570bQMnyuiQ== X-Received: by 2002:a17:907:72c7:b0:a7a:8e0f:aaf0 with SMTP id a640c23a62f3a-a7d400a4179mr740813466b.36.1722335605401; Tue, 30 Jul 2024 03:33:25 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f732f200fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f732:f200:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acadb9f60sm622455266b.223.2024.07.30.03.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 03:33:25 -0700 (PDT) From: Johannes Thumshirn Date: Tue, 30 Jul 2024 12:33:16 +0200 Subject: [PATCH v2 3/5] btrfs: set rst_search_commit_root in case of relocation Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-debug-v2-3-38e6607ecba6@kernel.org> References: <20240730-debug-v2-0-38e6607ecba6@kernel.org> In-Reply-To: <20240730-debug-v2-0-38e6607ecba6@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=807; i=jth@kernel.org; h=from:subject:message-id; bh=b0Pb+uSMgNZdT9sxeeZ9pRVHoEwmmPaSc/gj9kZGk3k=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaStOFjQ6ftE2lG/+f1E28LFr3rfr2zccEMg8XTilWhP/ deqrqvEOkpZGMS4GGTFFFmOh9rulzA9wj7l0GszmDmsTCBDGLg4BWAiXlaMDJNPe5pnNUnf5HSr Xcc/50SQ7sxf+TITys7xNcrvYT58V5zhn5GxtZSN2Rej9TtlWo9ctz007RxTsfzv809+PZdu+LA 9kBcA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Set rst_search_commit_root in the btrfs_io_stripe we're passing to btrfs_map_block() in case we're doing data relocation. Signed-off-by: Johannes Thumshirn --- fs/btrfs/bio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index dfb32f7d3fc2..c6563616c813 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -679,7 +679,8 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num) blk_status_t ret; int error; - smap.rst_search_commit_root = !bbio->inode; + smap.rst_search_commit_root = + (!bbio->inode || btrfs_is_data_reloc_root(inode->root)); btrfs_bio_counter_inc_blocked(fs_info); error = btrfs_map_block(fs_info, btrfs_op(bio), logical, &map_length, From patchwork Tue Jul 30 10:33:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13747231 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F6421A255A; Tue, 30 Jul 2024 10:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335610; cv=none; b=bZX161U96ZqlNrX4mZXPOG67z/IC5/PhQPxLWTfZz/4xjeBm3OYTZLvqJhT3EDcxpb1MYJWZeCLOe/YjQGs1l6dNmGdS37A5G17qlxJBAQ059nDgLuk0w6WXlugQl4P+MsX0ImmikCeEgzIDE+60jOqiASPAu5qhWFa/TAyEQB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335610; c=relaxed/simple; bh=inXac3o0DMNwtWuz/S+UQ8nNGZTrTw9eBeIrM2lygBw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CtikOeosfWU8Rwrb+GMSxi2ylsLsOtsCPvWNxoTNkIBBFBJXHbYFkvhPQxIeXElsxid3YeoZQstVd/zKfWxKmbLXjozQjK0YqQSTi0ZeRPw1ZSHK4xoDvUGjghfoZfqUAwtgtgdW4mr7BYHKmlK4IBqhiiMDDJherXYwlzwafNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a7a9e25008aso571508766b.0; Tue, 30 Jul 2024 03:33:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722335607; x=1722940407; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/JXRICrVSgwEXzupbqfI6N6cbUtwrkjonRVE0qX8bW0=; b=LpO2K9kdt4RW+032fWZhvlJke8BW4TjXgVXPoamMbmMIPJ6VlQnH7X1FQ0Z9Saw+d8 4XRYQ9ffniFu4LQHC33VhNQqXWEKn0LCeeUsKBac8REh8WwCn8Jz6uanlPFZUjJ2cJZD FC6xZOnXP5fSdv04cMBokz/VZ/E8K8C5nJb4ObbbXq1lBcF/GBetgujyhL04TL9nDzjW GW4xx0GIaUarcirIhe5wDazxRYhXZfpqCRip8+plRADL6NoSDal7QVpSmKSS0MZRrPEX 0CHs9ri+A+T6JVrUMgtIYY5ij7BBTl/+9B9znp6ZgMHtuSK9R4VAUp3haoypTqRoSvGz Y/qA== X-Forwarded-Encrypted: i=1; AJvYcCUXpnRKxcnF4c80hYKUWDewxUqjM1u/KHlunZIA6bW+n0X7Wt95tFFzYxhz1TxqbU89sSo2O+DDBQV0FHzehtDmo9TrkH6q0LL4jghv X-Gm-Message-State: AOJu0YwX8bt0IrGmxaRz8C/SvDKlZChtoPTvuiGNZAm/n4nMWw1/qf4Z NPpP/CG/FVUR8yr5QJmGR3zpWFzfKjhtw9RhNMA6aR8J8KwpZQXjpaqYCQ== X-Google-Smtp-Source: AGHT+IE3h/RAYumh9bRKQMeW38yf55/++7hMbfZeT4ue92SxlAfRGOpLoZrRW3YA8/JQpEHE+5sJEw== X-Received: by 2002:a17:907:944b:b0:a77:e7cb:2982 with SMTP id a640c23a62f3a-a7d40074761mr687079166b.26.1722335606405; Tue, 30 Jul 2024 03:33:26 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f732f200fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f732:f200:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acadb9f60sm622455266b.223.2024.07.30.03.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 03:33:26 -0700 (PDT) From: Johannes Thumshirn Date: Tue, 30 Jul 2024 12:33:17 +0200 Subject: [PATCH v2 4/5] btrfs: don't readahead the relocation inode on RST Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-debug-v2-4-38e6607ecba6@kernel.org> References: <20240730-debug-v2-0-38e6607ecba6@kernel.org> In-Reply-To: <20240730-debug-v2-0-38e6607ecba6@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn , Johannes Thumshirn , Filipe Manana X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5703; i=jth@kernel.org; h=from:subject:message-id; bh=8m/cLckIEbQtJPusx/1iIS9tmFdurtQoeVckBLSN0yo=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaStOFgg6yqidSzC7daGb+0OZ02c19+asOPecrNSuY8F/ zZZV7se6ihlYRDjYpAVU2Q5Hmq7X8L0CPuUQ6/NYOawMoEMYeDiFICJyDkx/K/dynm7e+2xNNXd fk4ab/4aBYq8ldTbX53jEfPpuE57yCKG/5H2tycc/5cbynqkRXG534SZC/8EtZzyvvn8xbqlGxS l1vAAAA== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn On relocation we're doing readahead on the relocation inode, but if the filesystem is backed by a RAID stripe tree we can get ENOENT from the lookup. But readahead doesn't handle the error and submits invalid reads to the device, causing an assertion in the scatter-gather list code: BTRFS info (device nvme1n1): balance: start -d -m -s BTRFS info (device nvme1n1): relocating block group 6480920576 flags data|raid0 BTRFS error (device nvme1n1): cannot find raid-stripe for logical [6481928192, 6481969152] devid 2, profile raid0 ------------[ cut here ]------------ kernel BUG at include/linux/scatterlist.h:115! Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI CPU: 0 PID: 1012 Comm: btrfs Not tainted 6.10.0-rc7+ #567 RIP: 0010:__blk_rq_map_sg+0x339/0x4a0 RSP: 0018:ffffc90001a43820 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffea00045d4802 RDX: 0000000117520000 RSI: 0000000000000000 RDI: ffff8881027d1000 RBP: 0000000000003000 R08: ffffea00045d4902 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000001000 R12: ffff8881003d10b8 R13: ffffc90001a438f0 R14: 0000000000000000 R15: 0000000000003000 FS: 00007fcc048a6900(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000002cd11000 CR3: 00000001109ea001 CR4: 0000000000370eb0 Call Trace: ? __die_body.cold+0x14/0x25 ? die+0x2e/0x50 ? do_trap+0xca/0x110 ? do_error_trap+0x65/0x80 ? __blk_rq_map_sg+0x339/0x4a0 ? exc_invalid_op+0x50/0x70 ? __blk_rq_map_sg+0x339/0x4a0 ? asm_exc_invalid_op+0x1a/0x20 ? __blk_rq_map_sg+0x339/0x4a0 nvme_prep_rq.part.0+0x9d/0x770 nvme_queue_rq+0x7d/0x1e0 __blk_mq_issue_directly+0x2a/0x90 ? blk_mq_get_budget_and_tag+0x61/0x90 blk_mq_try_issue_list_directly+0x56/0xf0 blk_mq_flush_plug_list.part.0+0x52b/0x5d0 __blk_flush_plug+0xc6/0x110 blk_finish_plug+0x28/0x40 read_pages+0x160/0x1c0 page_cache_ra_unbounded+0x109/0x180 relocate_file_extent_cluster+0x611/0x6a0 ? btrfs_search_slot+0xba4/0xd20 ? balance_dirty_pages_ratelimited_flags+0x26/0xb00 relocate_data_extent.constprop.0+0x134/0x160 relocate_block_group+0x3f2/0x500 btrfs_relocate_block_group+0x250/0x430 btrfs_relocate_chunk+0x3f/0x130 btrfs_balance+0x71b/0xef0 ? kmalloc_trace_noprof+0x13b/0x280 btrfs_ioctl+0x2c2e/0x3030 ? kvfree_call_rcu+0x1e6/0x340 ? list_lru_add_obj+0x66/0x80 ? mntput_no_expire+0x3a/0x220 __x64_sys_ioctl+0x96/0xc0 do_syscall_64+0x54/0x110 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fcc04514f9b Code: Unable to access opcode bytes at 0x7fcc04514f71. RSP: 002b:00007ffeba923370 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fcc04514f9b RDX: 00007ffeba923460 RSI: 00000000c4009420 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000013 R09: 0000000000000001 R10: 00007fcc043fbba8 R11: 0000000000000246 R12: 00007ffeba924fc5 R13: 00007ffeba923460 R14: 0000000000000002 R15: 00000000004d4bb0 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__blk_rq_map_sg+0x339/0x4a0 RSP: 0018:ffffc90001a43820 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffea00045d4802 RDX: 0000000117520000 RSI: 0000000000000000 RDI: ffff8881027d1000 RBP: 0000000000003000 R08: ffffea00045d4902 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000001000 R12: ffff8881003d10b8 R13: ffffc90001a438f0 R14: 0000000000000000 R15: 0000000000003000 FS: 00007fcc048a6900(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fcc04514f71 CR3: 00000001109ea001 CR4: 0000000000370eb0 Kernel panic - not syncing: Fatal exception Kernel Offset: disabled ---[ end Kernel panic - not syncing: Fatal exception ]--- So in case of a relocation on a RAID stripe-tree based file system, skip the readahead. Signed-off-by: Johannes Thumshirn Cc: Josef Bacik Cc: Filipe Manana --- fs/btrfs/relocation.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index b592fc8cf368..5a6066f6db42 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -36,6 +36,7 @@ #include "relocation.h" #include "super.h" #include "tree-checker.h" +#include "raid-stripe-tree.h" /* * Relocation overview @@ -2965,21 +2966,26 @@ static int relocate_one_folio(struct reloc_control *rc, u64 folio_end; u64 cur; int ret; + bool use_rst = + btrfs_need_stripe_tree_update(fs_info, rc->block_group->flags); ASSERT(index <= last_index); folio = filemap_lock_folio(inode->i_mapping, index); if (IS_ERR(folio)) { - page_cache_sync_readahead(inode->i_mapping, ra, NULL, - index, last_index + 1 - index); + if (!use_rst) + page_cache_sync_readahead(inode->i_mapping, ra, NULL, + index, + last_index + 1 - index); folio = __filemap_get_folio(inode->i_mapping, index, - FGP_LOCK | FGP_ACCESSED | FGP_CREAT, mask); + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, + mask); if (IS_ERR(folio)) return PTR_ERR(folio); } WARN_ON(folio_order(folio)); - if (folio_test_readahead(folio)) + if (folio_test_readahead(folio) && !use_rst) page_cache_async_readahead(inode->i_mapping, ra, NULL, folio, index, last_index + 1 - index); From patchwork Tue Jul 30 10:33:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13747232 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32A061A257B; Tue, 30 Jul 2024 10:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335610; cv=none; b=d83lXoQAi87PqwR/GPwDvkCnhPPm1yVvpQCh3CZ4sbxNy+pWF2gPB95D3ppZ4tL6BXmx5M4/IsFqkFGwexg/3U4xhswGFQ8dEgZ7n2PDnF8+XMc0bjL7rjCo0fmDY0HfpDBXMoHpUBm+iLS9bJWOgYqRhmW6EMhREqvqEUa046E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722335610; c=relaxed/simple; bh=yOFE4cthNpKAw1Wf+HIS6SvopF2maYH+CgYnhjyzGGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V4CnIygIH30n27NTK2pBngaWB8gf6Ec4YvFYopP3qlQcLP7PJte9smTLPkDdyFe89/yMY33cZlIxcV6vU5KBL5MGYk6cnNKom2m2eOwuTHk9IwRBpu3SThyFPZiXMZoRmp4BtDyTFGAbelB2/AwpGd9JAuCp04nUE5nwAl82H/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a7aa212c1c9so606802866b.2; Tue, 30 Jul 2024 03:33:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722335607; x=1722940407; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CaFTL1duU5GueP6k8bggejkXYESAFbdWPOLFrsucxBA=; b=MrFng3Hwg+lRRxARXsykX6zbk5DZrqWCSEgQaSA7pSx3jSD5sz9st1bdp2bz68vR/c dQgy7NII3f8e768BzRIU39MlTt9sxPPKBl74a9XLeA2PHqQws3Zif++JCJ7YYgD4/l6W Bm0mrvth5Spn4iYSADOpBXzqLzVYkKVc/nQHUxu7YjQD8NvBPdQkKQzfirCFG604y5AM guUuF+OjakOHDybPMl0ZtjKeMmbVhxGy7++Uu76CDUVa6IwhxOcJ5CzIvCI/qVbU6Csj 8q1+5wQG3Qz2YhL2R5NzSCSIFxcovdDtaz4XRxrGgQ+29Wg2WirwV/6gEDUq2x9002W7 XgQw== X-Forwarded-Encrypted: i=1; AJvYcCWDu8fijTCjOq5cZum0wHTlxvLuXsH0eoeYy6lObBJQ7BCpjKpxopD6Bij0TV37SDeWpfoLhG3GkUvH/Z2GccFD6G2oTWKrqTjiPsZ7 X-Gm-Message-State: AOJu0Yx0JjFNnXv4mzuEjT5C9rTrusywrpG3XiFPPYT7aMAbVsw5Ssbz iFtfCz5GR6Mz3WiD2HkgCtpfW5NWNeSRMNzEk8o5SZ6tKZyZLw8y X-Google-Smtp-Source: AGHT+IHRRUmXvR3WWPVqOcTceVSq3FWDHM1Sc7Qnyw/GDuk1HhEJ9VLDJxXOztwOLL35Bn+flWfeKQ== X-Received: by 2002:a17:907:874c:b0:a7a:acae:340e with SMTP id a640c23a62f3a-a7d400744bcmr665951266b.26.1722335607401; Tue, 30 Jul 2024 03:33:27 -0700 (PDT) Received: from [127.0.0.1] (p200300f6f732f200fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f732:f200:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acadb9f60sm622455266b.223.2024.07.30.03.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 03:33:26 -0700 (PDT) From: Johannes Thumshirn Date: Tue, 30 Jul 2024 12:33:18 +0200 Subject: [PATCH v2 5/5] btrfs: change RST lookup error message to debug Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240730-debug-v2-5-38e6607ecba6@kernel.org> References: <20240730-debug-v2-0-38e6607ecba6@kernel.org> In-Reply-To: <20240730-debug-v2-0-38e6607ecba6@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=920; i=jth@kernel.org; h=from:subject:message-id; bh=5Nb2TPyDI1r9k9JWR1KqOfBjfmC0JElmTsqSFizt6aE=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaStOFhwLfDCms/Vc9Z0qT9m4OTjn/bu41vHGRyPDRnOn FD4PkF9ZUcpC4MYF4OsmCLL8VDb/RKmR9inHHptBjOHlQlkCAMXpwBMJFWO4b/Xs/BM33323zeK Xi7vF16w8F9z2oXHO7j2W18Vv36woWIBw39/z8f/Jj7tffGWeafHLPsZ7wSvfb8uPZOrz+TaLuN /1v8YAQ== X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Now that RAID stripe-tree lookup failures are not treated as a fatal issue any more, change the RAID stripe-tree lookup error message to debug level. Signed-off-by: Johannes Thumshirn --- fs/btrfs/raid-stripe-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index bfb567f602b1..a734e25a6a55 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -284,7 +284,7 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, if (ret > 0) ret = -ENOENT; if (ret && ret != -EIO && !stripe->rst_search_commit_root) { - btrfs_err(fs_info, + btrfs_debug(fs_info, "cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s", logical, logical + *length, stripe->dev->devid, btrfs_bg_type_to_raid_name(map_type));