From patchwork Fri Jul 28 15:16:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13332054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDDE3C0015E for ; Fri, 28 Jul 2023 15:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235692AbjG1PQo (ORCPT ); Fri, 28 Jul 2023 11:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234744AbjG1PQn (ORCPT ); Fri, 28 Jul 2023 11:16:43 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBD811D for ; Fri, 28 Jul 2023 08:16:42 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36SF4N1E021101 for ; Fri, 28 Jul 2023 15:16:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OtvZDcfIa1Uv6mFYN2AMnxd4rGxJQQgBBNB42/5Nszk=; b=D6cNuYCP6Yv7qHChsXQy785ZznnlsXkskYvEA89fVtANli6NUY/jnn6TvXdhJ3LCkfA6 SzRLzT5OfzjdgmPsX76FLxzVKrcLiXZc4irop/24GLjxaCqG/d9TW1dPa2o9dhf+2UOn DBz8ckSi9IuabILW7Ex5ZRxqG7hIgjjgOmb+L1+us773JHV9VerAdiWBAdqknlLEE18/ 5/HNeNyRycLDMMiwtTnVWhIuoVAx/zN8DTmqfMNk73M3bhiaAoe/a8zY5yMRnrfYMDtR ohypTD7bKk20s7hVShMbCS2JN7oHblOwDhv4BCEoEiOEj3QNkyFm2K7EAfMw7n5CRxnU sA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s06qu438g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36SE60Yi030496 for ; Fri, 28 Jul 2023 15:16:40 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2042.outbound.protection.outlook.com [104.47.51.42]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s05jffy7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hMb+1nwcTRCu4Y13jhQT8/JN6EagLRzmFOotnBChGbqK3HzjfANF7rg4AEZNF/satoPd8dKFU/HvMNlOvV+foj1a2UO1mU2eiGX5P8FeXvJdCHXwDF8wQQnh9CNdJxGLiD8LUTEkMTwIOsy2Fdct5mMEfYGLGyPRXj2QaGfHbk/dizQERWhzNl7f8FK8i78e0K0rxwj2LnZL8CNva2vCMvJNITFuEmrd1Tus6v4JUN9+Q1YHYPSwTgDKkqquML1/QW0FYq8PfQyM4qafJRVZ6wcA5joAFU53DJiv+0j0o6Qxl0KGNG4fSGRDH5KcHkZl5kRbiOwMkzrAzRH7OlWSRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OtvZDcfIa1Uv6mFYN2AMnxd4rGxJQQgBBNB42/5Nszk=; b=d5fG294Wjj4lWaimpnwbGnazXdbyb4CpHu04oYtTv0Ex6ZRK9b85kVa18YWjbv4MEgPOF+Dfk1VQrkNpms9Wl7f4jBA5d9eE32Z/LeAOR2fXBdwH5FwjHGz/UXF0O5tivo1oj7qtTVQb6wW/ewWdPqexJAqlFOgXvc0zUXNjk9vBVjtlE9H3PfQTHOGuIy9dPSS3bPPvCuodibl+Fbibw/RiDHsOVeG3S54yj+gexzRbrqKppIaRtZRKBAIUC1NTrLLB9GBv/1HUV+JkTyeFVfSa3EDQNJdpcyYNbxwHXtWNW0VuAtK43apypo1GdYhdJigkPIbgua+v9KmMT7zwPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OtvZDcfIa1Uv6mFYN2AMnxd4rGxJQQgBBNB42/5Nszk=; b=CtHDgMkecY9X05Blb7Y+fPGF886vw/+hnXdQjVDITPJgKuudYCNx4vRQz3XMVYy2fnV+39pbB7BENIdSbpT6I3dJ9keM3DF6c3OWMCy0VjikP5N2FJqv11hwZ3RmSlJgdaUj5HOqDKkAUA76vM1tsKKxqzg5fRvsPoaLg8bYKMg= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ1PR10MB5930.namprd10.prod.outlook.com (2603:10b6:a03:48b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Fri, 28 Jul 2023 15:16:35 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.026; Fri, 28 Jul 2023 15:16:35 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 1/4] btrfs: simplify memcpy for either metadata_uuid or fsid. Date: Fri, 28 Jul 2023 23:16:14 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR06CA0015.apcprd06.prod.outlook.com (2603:1096:4:186::7) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ1PR10MB5930:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fd4980a-803b-4d82-619e-08db8f7da1b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9v8FMJgKAxFMm4SJO/e5EblnAZVhy42HxGqLm4KXYyNApjeCfws+6js0KUSUu2dXmkhO7S9Nhf3nsupGpiiWWcC3cSDgPnWWv4rkhh0jWWt8j6/RuRysioZgewM4OfzX2eoNRub6dTsr1uAgANta4baNHBs8BxQC5+i7GfwIzUZ/eMjENAW9r4hj/7XPtp1khfaRlJMxAb7yixXS0Y3dlLCsNktIdWoaZB/sBHPwti1vWjC/mY7IEpCjKHC69CNpPy3beX7RnruuLCr5x2YsBFEy0h7gJYgtalO/Txgq6YH7riwokjT/N4dH0a+U2uoklgoNPPtyNRrOdkpeQD3Ui/K9cCfaI8UIaZ9ELBWqtr/H+4cW/urBfWta0lZTVC0hBjuuhFnxHJzoVi45tVOXwbXJLxhEU8YJ+9n5t0yyzWSe+M6DacRuXjBXGA6AoIwf7mTI50gvOeJZ82bhh8IsgjM2NeXg5vTqRyhCiu22pIMgh9+dw9mP47TeeBVFG0F9seAiEeZghqq+pS3WOEr+poD1a5xq7Z2M1W8DxKXIRiY4DaDFWBiNcCu6lb001fIA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199021)(83380400001)(26005)(2616005)(8936002)(8676002)(186003)(5660300002)(86362001)(6506007)(107886003)(41300700001)(6512007)(6666004)(478600001)(2906002)(66946007)(6486002)(36756003)(38100700002)(4744005)(316002)(66556008)(6916009)(4326008)(66476007)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cS5DPy8h+QlSRDYOCX5ioFQAodWgnXhWf4ea3AYo6QK7cQfShstiKi/trWwcYkUi4mOdtd4TIDsAqQ8OhiufEYzYeaejlNqlMPtlObXFk0dgAydG457OMtfLcHhV/Z5GMgqUA9X81nd1TptNGMBkGPw1wwRzpwvCSvMU3yyVt/fYU7b9ZEtkU7iXE/1di3z0cifqsf/uwDkuYsTEYaDGokjXnXuehU6t34IpGjmm/cWGkLp2XbQ6v57V8Lsqnydy1SDTGaKgz6nehCiSC5zcaaGKwImGg7YUGNyMQSI9u68tQxSjzylKLchW2b3j9wga+GnuTUrtDvBwkVNphy8mroYRregKYIisBXi3nXzWAPPE8UQrWrmaqz7vFsyTJnRPzoElmDyPtl6JPZciQ2NN6thSVsmMX/978ewUvtDxAgJI8bzGsOYCRT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soEomYnnvmUhED/lgddnqXMkCDgkkSz/kuhx9mmUAMkbIo6I0WkYnQT X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: vpO+vbz+dLMpAQAooSJeX73rQ0n9SF6zyw3S8pPQ/PE+f1MGjAaC1dP5RmyYGxGT6yiU57r+7xdSko9wPRnpq52ph3jX64oox+xVgvDOQTdikTYKhkN/0cCyqQn5BmmjiHnK4astKu+Osm0r6lS2l3D6vV30wOzCU6QYtl1RQnI/omksezF0hX2ztrMm2Vesp2DZNI045mcoIFlWxiw2vMIJ64NIyrdoIQrfRTJJ/OzCLd670t6FcuZQq4/W3umktUvBwgezDaEsoB2u+McDmH9LO9nlvOzT8lHIKKGXvm+EYktDpotYzOs7x7h5MuIHJ3wSXi/p3VzgQII+hzjYCIBB98NI2SOXK3i0acFrjAMcJH/qOfobnIF/pslr02TfIxpTdCCdtLB00QPNrSOL0OSjJNtSc4Aj/No2AKiSM09JDInYi7c8TAfRPICLENAXO/51sSWG2e0wnKImPyBRt0Ofk0GC4B2TwSHeBOrzVljPgJi0gS27pWhj8ZaUQQ4rAjvYJvYhkcbjqfBa97HZu2xsLgmnUHlIJu1pXXI3NJsdr53lxQb9WkJ4LflhDfjNvJWBRGQ89BhW6gxP82CHSDnLzuXnbgUSOkCZHl/24jn9DtSdyv/SpMq1ZonBcXdX3R0UIGUZwIALUd9oNvTU6XMfv9XP8dQL06YxwAIw+EVpogJ7bjbv32JrbdZsb7Ppsneg55kYIDyoFBDcvgSmWGOaCwmmOGQ/o4clawGWnsPP6rOP8N+ir74C1uevgvMUCZzfz2XWoWXdNv08U0nY6g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fd4980a-803b-4d82-619e-08db8f7da1b0 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2023 15:16:35.0744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G5Cg/8xcGIWjdTfP8kOfg4ZJFctrPLeuNssbXzjG7GawiOeTBWNZRZ14uSjzZeH/DFXebLNDj7PRTp1Te4mfMQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR10MB5930 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307280140 X-Proofpoint-ORIG-GUID: hsN6L4o1gN97WHqq02zLCrdwVVlgA0LN X-Proofpoint-GUID: hsN6L4o1gN97WHqq02zLCrdwVVlgA0LN Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This change makes the code more readable. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5678ca9b6281..4ce6c63ab868 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -833,14 +833,10 @@ static noinline struct btrfs_device *device_list_add(const char *path, found_transid > fs_devices->latest_generation) { memcpy(fs_devices->fsid, disk_super->fsid, BTRFS_FSID_SIZE); - - if (has_metadata_uuid) - memcpy(fs_devices->metadata_uuid, - disk_super->metadata_uuid, - BTRFS_FSID_SIZE); - else - memcpy(fs_devices->metadata_uuid, - disk_super->fsid, BTRFS_FSID_SIZE); + memcpy(fs_devices->metadata_uuid, + has_metadata_uuid ? + disk_super->metadata_uuid : disk_super->fsid, + BTRFS_FSID_SIZE); fs_devices->fsid_change = false; } From patchwork Fri Jul 28 15:16:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13332055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CABAEC0015E for ; Fri, 28 Jul 2023 15:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235711AbjG1PQu (ORCPT ); Fri, 28 Jul 2023 11:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234744AbjG1PQs (ORCPT ); Fri, 28 Jul 2023 11:16:48 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B4C11D for ; Fri, 28 Jul 2023 08:16:47 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36SF4Zal018474 for ; Fri, 28 Jul 2023 15:16:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=XP4hajZdjLN+VdDBd3Kxw3rQyAfyw/C7rT4D1TnRnlc=; b=hey380pdnbRTUKwwtftlwrg2h4FsAoNq1vi2+B8CAB0qIlMLA0uGIN3Xcvesri8QnNXO kr2WIdvCHjO782AJdNMhdUsYEmy6nyqmAEMwIBGVk3Fm7Lb7AnaVHxDfc3Mlr1glPrc0 jwhlwYJ8KATUy4g5BJqu2KWDZnpTCILrjZTJqwFNq1ZSASNmRkm3FrrfMLUnUhIgF7GA JWJbtqjBeOZeId1VGbEROzx65sybnMxyymUA8tbOl9URxlU2etIgLwf9rNyEPoImKT53 OAK5/XTCGFW92Ld+AG5VPDfxX0wb6kdK57m+EQWtLIuQ3kNO3Eu46W97QKQV2PktrNVD QQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s05w3v4gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:46 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36SE6phs029437 for ; Fri, 28 Jul 2023 15:16:45 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2049.outbound.protection.outlook.com [104.47.51.49]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j962fh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3NyGeAxQQFRImptnGISv6ftcUPQOg620p/Bey8B+K7Ik8cWw/WTDOq8EFDKMqWO1DFqiyuQsYoVB1uLkDBcTqAu/KjJ+sCyVFn0OIHa8+1y7PignrBw+0Kb6ZFs6pgk9L7L5EEEzcL9wyp7eBOuBS7xUiNFdKHc+nEXyXYLcSHcieD1181rUwHVTg5Fw6heDV6sqjEAqnxCTsZS4y0yMjfv1/hqtKQCUHCnwQ7W7Ni4yMNfiju9SaXemZ72aEomYwqZ9OfKXxiyfoGa11HnPXwP3xOzC1QzNMJ/GOYutrjykKj2zNleQPiL9cbnN2rgx++xAtBB/DsF28Isl1Ce6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XP4hajZdjLN+VdDBd3Kxw3rQyAfyw/C7rT4D1TnRnlc=; b=ej3lxjosvHQ5KV1zFQmjaKwNaiPIeGL8IfDGBkK1lJSZJPEuiFwkz1p+GAiSVs3WcXWr0t9sxJu6ON2XCNbWr1DL6uZFwkM7Re6IehrNEnJqX+SHzXXfCyKTm1WqjqPpNelAsVUgx3vkHXmTS2eY0ej34XCwcsuuqxO3KdsCiUKXdLG9vPdV30yFKmmm7gQajI+o/g8Ycdyq/o7IQmGB/Xz8kXIWZn6dX0Mwtly34jT7QBOKIjHHbhJ2GlXrQDJzI+NMP9ELjLu8SLKGqNsxXNicmzJIz8IlTK5tAbyh4ktPHGF2FBa2IhZPcVk2l2oGr/nbFcY0Pm7bzKDpd4lHEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XP4hajZdjLN+VdDBd3Kxw3rQyAfyw/C7rT4D1TnRnlc=; b=OaX6qQxaDzK9DsjHil3rhshsTle+9bsztgo3xYXLd/j66xpdZroBN7moScIL7jeuQLF3WECDyp/PRPZSDouBAHrupbuFuN+LyIki4ug6TftI0wL8/CmDK/TbKm1umL/oW1KBhO8UBZBvanx6aVkBWBj7afnSWq8oDbpW6cmWDy8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ1PR10MB5930.namprd10.prod.outlook.com (2603:10b6:a03:48b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Fri, 28 Jul 2023 15:16:43 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.026; Fri, 28 Jul 2023 15:16:43 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 2/4] btrfs: fix fsid in btrfs_validate_super Date: Fri, 28 Jul 2023 23:16:15 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0126.apcprd02.prod.outlook.com (2603:1096:4:188::11) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ1PR10MB5930:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f2cf965-5ca3-4277-6206-08db8f7da67e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iv3poSrO7w9pu9FiD6YiKjmH6RmzVVX2dBF8QgFff55PCxonJvPlQBbd66c99q7W3NZp/DKTw/peySLLzkvhBU/OXuryhMkq8vv97WhFs8AKRyTQgMrR55qAvKp9jBJYYZ9kmVgfIt7b4bjEi5O2wZst/UOJOTt1sBqcwkYxunWWUy1v8V0VrGu0EKgExE55szAzxSGJOEaJqC65Z3j3KcT5hwIkrqsiC/Y2Shxwv8w0vgHhi3F4hhC7Rop2ht5AuYny8/kuWG7iCK+1v5zWvWocgOZ92Ex7a38ZuTjj4dG2JRc+NNB2DFlPJlq7/nCxFg0l3Gzn5piUwYBsz+YQAZhmdc14PfnwXcjPOzV2GCzLsNS1xHwL84uyxc/ImRrE33Zt3qXN4IJCKfgAPF3+3PL88j+uioLEnhUZZF0aVRhmD6WzN+lLPRP55W4bTuut8w3tqIqrxUKkAZMyAUZYbzXqWpnAhYofHkBoITWrS9VRx/O1jCX4t7TDznhgZHTUZR+GeI2d50oPCkyJvMPGESuol/iHMI1HGi+B9bL5xuEGvcklXUe32hoYAUH17mR3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199021)(83380400001)(26005)(2616005)(8936002)(8676002)(186003)(5660300002)(86362001)(6506007)(107886003)(41300700001)(6512007)(6666004)(478600001)(2906002)(66946007)(6486002)(36756003)(38100700002)(316002)(66556008)(6916009)(4326008)(66476007)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MnXcAvY10Zcz58dKZXLMc9cGtJQlh6aHIiEPBfYJYPp5d4j1Y8p3z+5QVW1pnvCkqs+deYbkrZnkASo5gc7Id4VtjzZLHn15+/hWgGgLjlkcUz3IJd/3NfdC6AnvvQXGRvCgmG/kuHFvMraAJUVfsHVGtCoA9hI3afh6V6G1LKHDmsBPIGub/0Lcp5YegpbdMvoqTq5Va2co9c9zNfmh9tY09UxARhtTW9fAd5ipo7FKdl3kWjPAEqlda7G3FgWouojYKs4C1ek9awL9WBGdTW7yMOjkTtsi6DN3auCIFY4lx0MAQtvPQMB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fMNOpMrHYwi/AohBoS13WBCOaQELi0vzDH9jne/NtlIsnlhgBPIGDFwzyeDoraAIagljKGBcix2jSUfH0fgw2FSlKHXGgLae1etMCbfXIGijKeUX7OA6mU4JL0EPTSUFoLVOP9fWItp6palN2eikUFcKw8XTwyo3/JD+7JJ6odeujzai3zfsiVoYngwhYtFDapsEl71uTxlzDR7rK X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yIkzwcgIAUdXFeucz5+jp+duDsla50+kHaFZ02YJsbPyx7yWPNZ6O3AdpuLpXiKU4QJGJwkneSzlU5i+4A5aik+3lEH21ZHpzfpzmHnWoS3V62jcYaT7LS4zeBypCEK1+x40pLkpn8YKc6qpX0TFK4Wb+XmxG/ij6xV9bvdO3cRiWGe5fT5ctjrCrwBZi8jssMBVtkZCDwgJGCgKhFo+1gkFSy8LoiZ9mf0cJIEAuAvGF/Iu8aQNCA0wZCgtiufLZePX3wd/E3uxXO4IsS56SDJ2nIMej+2FlTdg+dMpJidBvGqka6GewM55Rp7jECCOy33hY8lUe9085jBVi+GGvmGY8awXf5uSuK1WJvhCyBMoDXFLx1pLDEzoJehc00FNtv7B+OaX5fS0oogCeQnHbv717bOfYNNpwpmf1a4EJaaqdY0UhCL8qkEcbhHFtM3vdcnGqYBa8lz3ti48y+NCIbpmtGMPz7zsQ+5Wx+QCV9uckTa4ruO/2ZJUGGBagr/49ia+F1cHIxMFn/3mjReAygoveiV7StGPIvS/KVaPzLBMEco3SK4ITtvSJ8ylhegyJGPSxXUfUrMpOHg+JhSJtpxgxVjNEvrLoz/H7rzxXBvVxxI6oIdCKOASpu1LzJ0TguaC8NpFwZoDk95fApXXDGcLhRGFGNxvsi5nXkk2896xJN59Vi70OhPzl4i2x6i5P+egmwbb7NKJfqywISPFS4tBFvyYAcNx3MWcibuFApdP+oEoYTSEVfv+6FeWY2m8vUVsQJH3R8n6BQZO8dezOw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f2cf965-5ca3-4277-6206-08db8f7da67e X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2023 15:16:43.1256 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jgg4JqSRs65spHQslnh3Ruhl6fcInJ3K9VbTVwDZFI0bA59D8EppQY0ukVeoqkVmbzUgVzGU9/m7wJykPMP/9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR10MB5930 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307280140 X-Proofpoint-GUID: GgBFhxXTQYbe1Mys3LeVtpZRlBM25bmS X-Proofpoint-ORIG-GUID: GgBFhxXTQYbe1Mys3LeVtpZRlBM25bmS Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function btrfs_validate_super() should verify the fsid in the provided superblock argument. Because, all its callers expects it to do that. Such as in the following stack: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate_super(.., sb, ..) scrub_one_super() btrfs_validate_super(.., sb, ..) And check_dev_super() btrfs_validate_super(.., sb, ..) But, currently we verifies the fs_info::super_copy::fsid instead, which does not help. Fix this using the correct fsid in the superblock argument. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index b4495d4c1533..f2279eb93370 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2373,11 +2373,10 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid, - BTRFS_FSID_SIZE)) { + if (memcmp(fs_info->fs_devices->fsid, sb->fsid, BTRFS_FSID_SIZE)) { btrfs_err(fs_info, "superblock fsid doesn't match fsid of fs_devices: %pU != %pU", - fs_info->super_copy->fsid, fs_info->fs_devices->fsid); + sb->fsid, fs_info->fs_devices->fsid); ret = -EINVAL; } From patchwork Fri Jul 28 15:16:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13332056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1DFFC0015E for ; Fri, 28 Jul 2023 15:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236077AbjG1PRD (ORCPT ); Fri, 28 Jul 2023 11:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234744AbjG1PRA (ORCPT ); Fri, 28 Jul 2023 11:17:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4986F11D for ; Fri, 28 Jul 2023 08:16:59 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36SF4br0018529 for ; Fri, 28 Jul 2023 15:16:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=tJAybxNMykSsIaZSr921iii12pHID17QoPcfTgtfsLo=; b=SwbzhkMD5T4fUWc4ASf/by5sJcsn/yyc4SjS0UqWJupAZ0j9TlZ+nvrExtJU737Cidl8 4tzjNPz6sSDyLebfQwyKVc8OQKPbz0GZfp8k7EPC47eoK/nFbRdWYu1a6Dz4b9gMWYSK AP6DALNPNGwvY6/8AJ73oX3Zf4rxUE2JsniMWHC38dEe9sVto+Ha0zAJmAIg6TlEjFd8 UYi3X5BEbg4YwZALBPCC31OewhIVZUYpDCpc2FP2oCExdp4yUEM2JGHavrSt2I1VNDLA jqNmM2ZlAyRBnCAswG2Id6Dbz/p5rWenM7qb8lPZRVmcUQXCb0OkhHF+IhJfniffUzYQ iw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s05w3v4h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36SE5ZfL011704 for ; Fri, 28 Jul 2023 15:16:57 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2047.outbound.protection.outlook.com [104.47.51.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j9ec50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L4bvyCKCOpOX3p2Z6Gmgt4XjR7Ici+7+OL8gtkPZBumJQ9q6Im2UIP22SU5ELJSnliAGSOaiwoZHMjJvlOlT/5hvQaqCl0D8ZPAtG5P6ZMO+0+B5T66UqHH1zhIRfXOf3+ElYsyeINs9d9AsjIaW5nAaUsyQ2KiaEiYqk3eX+C0rQ6X0zqeZLVvTFJBI5YoJvppqdPQ7Ro0mS/lldIbXbVzhpCJktgMzOPqXi9JvciWEvpdK4HINDxdWVeJUGen7FkDY2z7mN71lx8bYHNWnh1gFvnGzE6vA0dMOC+MMKZyBjm5bKTApIIUnhno0+LRczafxGvVmP9XdxbVWMz0soA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tJAybxNMykSsIaZSr921iii12pHID17QoPcfTgtfsLo=; b=NVapV/km/LIRBFCnfiKhKBq9OswlFPqX8VwyvOfXfDJEfvNJEtHELbl4+0KT9QYxCawzNMuUaXdHLFsYGlzB9UKCRzfzTTWxKH48rhxIdBmckkWqRawkgezJ58no2qkp+/TYkqjsNXAt4mdCt0AuSYCbFFsW6JeKj5FTmNWnDo9Yx5WX911nnLlmrs7uAgy/cCFxzrrTf34TA6uDojCrMcx5IfjWgkTgiRGFUVerwGHYt49sIeOfehbCCEYKdUo7pNAHK51Fa8268t4cOyVF5NziCi5KvVhSp2HaR2OXVS2OmnWYwI18MaNBlhtLoTe7iRHoexoFlukM9zhetdw4yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tJAybxNMykSsIaZSr921iii12pHID17QoPcfTgtfsLo=; b=v8SJxmvbUaFu0F5CNN36Y0eHsIHV/EJXX7cDws5ZlnEdbzUCAQvUZ4Q/y/in+umpXhHBXLJk10Sh9l5/8zL4VNLMZNC0J36kROMv26EX2+SBILBdebMPEqs0zSJGzAGWLzbgbqHThZhiKj/6/CbXwEo2360AlQbrPSaHAhNDk78= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ1PR10MB5930.namprd10.prod.outlook.com (2603:10b6:a03:48b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Fri, 28 Jul 2023 15:16:50 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.026; Fri, 28 Jul 2023 15:16:50 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 3/4] btrfs: fix metadata_uuid in btrfs_validate_super Date: Fri, 28 Jul 2023 23:16:16 +0800 Message-Id: <484851af56e2ec6a434a10c80ae336f22b45b305.1690541079.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:1f5::18) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ1PR10MB5930:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b959f4c-81bc-4eb9-b794-08db8f7daafd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AncqB+TyNA9ZpMhHEGGm9gkp/3SB/745hVcOcyP6H0LNIlvr+c7tRUs+sjdox+JEFW2C1KeTasJ/SBQSewubmJMdT9cuhDZ8TLWyDLmdVn20diN6GUuB5/8905G2yGOrX99QSZVDmLnmAA7gi9m7/phZCbiMsTs8bqQkzGfQvu01lo2ODbtmi52be4UmpbEj7Ft4grJVuzF7I0ltaiE/YS47PJKNuX2mcGaut+KeqUOXysOVbO0VyOwser7TrFyajX+xb+UhKBap3EFiMoUE3JNz2NjZjhC2iV5B7HGcPBBeyyss60o8cIVhLSzwy9OUbWpYocsrWyiukVqkkSTaCqLYwPhSatI4bdtico5mw/6vN0J0+EUvn/G3jrquuiQ1fe2wMYtplwP06skEmKHgJpmID2vg6uZ8svqiaHX5ZaoqUL8xEu/IsaPem+/s5o/RPMTtIOP/LdPwSse2t+k9Fq+RjL1NC/0wGrOedk9qhOWmNSmiF+jgvN21skfyUSVK+h6/kOtu+xs4BejxIJNoTTipkDWw2jJvYu678JxoGoLEfqWeWlsHt1twwPaqQXp3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199021)(83380400001)(26005)(2616005)(8936002)(8676002)(186003)(5660300002)(86362001)(6506007)(107886003)(41300700001)(6512007)(6666004)(478600001)(2906002)(66946007)(6486002)(36756003)(38100700002)(316002)(66556008)(6916009)(4326008)(66476007)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: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be4RX7qwudwTVac57Kiht83gGcPIFrixBQHiGfpDbXRmBjO8RGWqP8LvRsDOqleQzUtUKjb4IPw29pNnBNmI6AHBdsgiUfuA+hj3i05xvN/uj4OOotk/LUm6UEi1gDKTVOwzGBWzEWVAmrXVaIy9hT+n3Hjaqff+5m7/W5uHHeYqWicoSuVaytBsQuomfT4xZo7BHMPazdKkI9JGrSEXYsN+uOcTVcKlH9dqOU2uxlC3j7MaC4iyB+dyVFNkAilPx2SaqTXjLtij5tHFo9i/nwvsClY588b6TAci3sXeenpWJVOm2uzT6iDaz39ISh3dm2YNppw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b959f4c-81bc-4eb9-b794-08db8f7daafd X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2023 15:16:50.6615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1KOHST7ESBYzgmZWjsz31qPtL4PPcd/tNtolQGhQeESBKtxfOZwLNeNwQge37bEp7u6roq04NUY2++i10x05ZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR10MB5930 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307280140 X-Proofpoint-GUID: 6azpUqfX0TX7DjYq8ajcMiXtLpYzitg_ X-Proofpoint-ORIG-GUID: 6azpUqfX0TX7DjYq8ajcMiXtLpYzitg_ Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The function btrfs_validate_super() should verify the metadata_uuid in the provided superblock argument. Because, all its callers expects it to do that. Such as in the following stacks: write_all_supers() sb = fs_info->super_for_commit; btrfs_validate_write_super(.., sb) btrfs_validate_super(.., sb, ..) scrub_one_super() btrfs_validate_super(.., sb, ..) And check_dev_super() btrfs_validate_super(.., sb, ..) However, it currently verifies the fs_info::super_copy::metadata_uuid instead. Fix this using the correct metadata_uuid in the superblock argument. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f2279eb93370..8d6d7c23d37d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -2278,6 +2278,14 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info) return ret; } +static u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb) +{ + bool has_metadata_uuid = (btrfs_super_incompat_flags(sb) & + BTRFS_FEATURE_INCOMPAT_METADATA_UUID); + + return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; +} + /* * Real super block validation * NOTE: super csum type and incompat features will not be checked here. @@ -2380,13 +2388,11 @@ int btrfs_validate_super(struct btrfs_fs_info *fs_info, ret = -EINVAL; } - if (btrfs_fs_incompat(fs_info, METADATA_UUID) && - memcmp(fs_info->fs_devices->metadata_uuid, - fs_info->super_copy->metadata_uuid, BTRFS_FSID_SIZE)) { + if (memcmp(fs_info->fs_devices->metadata_uuid, btrfs_sb_fsid_ptr(sb), + BTRFS_FSID_SIZE)) { btrfs_err(fs_info, "superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU", - fs_info->super_copy->metadata_uuid, - fs_info->fs_devices->metadata_uuid); + sb->metadata_uuid, fs_info->fs_devices->metadata_uuid); ret = -EINVAL; } From patchwork Fri Jul 28 15:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13332057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 411FFC001DF for ; Fri, 28 Jul 2023 15:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236318AbjG1PRE (ORCPT ); Fri, 28 Jul 2023 11:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235712AbjG1PRB (ORCPT ); Fri, 28 Jul 2023 11:17:01 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA9E187 for ; Fri, 28 Jul 2023 08:17:00 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36SF4OgL021201 for ; Fri, 28 Jul 2023 15:16:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=B7HtQjEwOn5/0KurabXItXa2dhqCN968zO322fUu32A=; b=lK4lQHSIqtV02M2gmJerKB97OqcaCOddynOynETM86v0Cglxf7QS1HJ4F9ys4zDHw3xz AXSekAkkDQCRSyTrFKMpoc/rpS4U69nHPigXI9jumxSkJA2+gBBcDAz0MsXZmknhx6nF 3F02FiebQSBmBmwzz82/AIoKcNZx9cMirKwFW2wpB9X1Gqogblg/TsDn+DVl/vEsUMtR 0acRyzAqqlwuUPPh5sHhKZb/rGnvxs/Idlj6mgCyFtvWGAESMuYIAgqMyGco7Pkdprbe 77rLk0niejHc1s/ybkb0sGqqoJFKWrokaHfgQAKV8hXW8mvWpM9hlptZMuSlewaYWUsU aA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s06qu439c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36SE5ZfM011704 for ; Fri, 28 Jul 2023 15:16:58 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2047.outbound.protection.outlook.com [104.47.51.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j9ec50-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 28 Jul 2023 15:16:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nKXBG0OaCCmXQs8/Kb7YEuJJtX/IGs/OAMbyINGGaFYflOM+bknBk/5kGcuTo62iKTs98nGtp2gQDiQlMK/K9j7awSs95xDapmW+hjOcFkxlQppM09K3EABJwnH/u1czM4d+a32kS0RoPlTVz9zV1HcFjkE9SmQWb7x6y4jkfY5NQZlqc1ypPs1t2v7/9dt8VPBvsYYB6I0HFWefH0smF1Y62yvlmHOAy2Foo5KrGDf1kfZRjps+In6JvhVciGhPC7K3kHF0jK57fgQA8JvJA7oOpRZsGA0QjiUf8N0S37ZbLwwPYbmvfl6glZH67gzWltmetlploQHVNkYehyNnvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B7HtQjEwOn5/0KurabXItXa2dhqCN968zO322fUu32A=; b=RMTW5iFNMnwvxnc3EEfLMsPIdcb89OJC2XVAvWrudyJbsYkKYYm03Kpm5HFjG96d7vpBkt0cj/ZCkA879vXRVJdUySi/Jxx/kFfrEwZXIAjVjLduqyEpRr2kDB9VYD4wOfHH2K00sKiK9ECeLYfAVDMn7LANY0OQ8TjbXdWeEjb6b9h/dv1fSZSwT6XJxXw/OGcV3bwE3kbocWJc4JX9TeiCsovYz5ymHLWTRM32RvFSZ/rmP0cbS6lyp2SDvIuA2N52xKeFSZaXy4tka97vs3GV0br92qCRf0i9cC5zfQG+9FyqsPmAIb8Bqs3dUEsBteOGpnJSXzNqMpXWoW0LCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B7HtQjEwOn5/0KurabXItXa2dhqCN968zO322fUu32A=; b=CPfWYQT3mbaFe9bLwtnqN5t3PfB+dXCLQK59EEYh74hGHPtjdV7BYgIkxXEioKWl0J0c4gKj4Z74ZWOLg6/uxBgBbNM8TUInVPYY53pBngeKJJssovILmCKOu6ltgMWkgy6oinlGhIHSnLEu8BsiAAHZ6+zVV9iwyovopiAcrAY= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SJ1PR10MB5930.namprd10.prod.outlook.com (2603:10b6:a03:48b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Fri, 28 Jul 2023 15:16:56 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::b3cb:e0d9:ef96:aa56%4]) with mapi id 15.20.6631.026; Fri, 28 Jul 2023 15:16:56 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 4/4] btrfs: drop redundant check to use fs_devices::metadata_uuid Date: Fri, 28 Jul 2023 23:16:17 +0800 Message-Id: <2f9c32327b7ae064656675459ba656719411928e.1690541079.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0040.apcprd01.prod.exchangelabs.com (2603:1096:4:193::14) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SJ1PR10MB5930:EE_ X-MS-Office365-Filtering-Correlation-Id: 14be4b34-335f-4304-4cb7-08db8f7dae8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /CFT75V9TlAEvv7NahAa04/nYHYOkrS4ynqDektnfY7MwG6AR4utX9M/vE0fftuMSUBl4vioYc/ij4oyEqstpB7hV9jKaKfnc7QlCQBnDGCG2EJ4pcT1one54GPFWeS4t5OzN4uTI17wHLqagmldDzVJXPoTbtWPHiNaGpOZ0fqqQILi7eQWaZyIpRh7KzI1t7ZqC8gIkd8nKq3QbvBBspTL3pfLJWMDQ9fRVvg1r5yY24U8k5ZbH7hb9h82S5BkVnoAE84LZ+oHyrTjQyxCYVuJj50sKwFdA09QIHAI1UZ/5xdrH0Tnjfwaqx0WWkzDBPNNp9qUpR9b3caRvQrDm9w2wbJkBUIqIYSra8JzE0ElyXBzLEOZIdeIHb9V6GmQtDGtYR0pi5D3vF96xxGLO2wAVXgFoYkbTz9RpfUuBpKRiMtvkonHJMKRpiSGmvOlLFQD3MIfDFxRNZdd/ltfc/R02IaX7bX8InwEe6pO2Td7nDZ/+QW9DrPGRcEzINSq235yf4gvZHG2A0/FjVG3eysgZ+hLUSs0c6ZiuXLoUraANk88Z2+I6muuMyiz+JdJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199021)(83380400001)(26005)(2616005)(8936002)(8676002)(186003)(5660300002)(86362001)(6506007)(107886003)(41300700001)(6512007)(6666004)(478600001)(2906002)(66946007)(6486002)(36756003)(38100700002)(316002)(66556008)(6916009)(4326008)(66476007)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W2fU1qcHJiHn5wycQXTeLt0Yk5Rrv0imNYoyPXYB67iwJHlr7MtoCw40AG0yOR1dKmsoyX2LLKVFK81nmUJWYO3DbLWa2XfCIiLUgL8mWMSvBFLO/IBzbISiMXPynH4neQluvEUoPnpI4vLWVf1Lb8S74NdGpyzrSwXrsmFWabqvWh0jYs5UpOUzMgTTtZWrHU4siEEwGlYd5LOwBacVkFQXq7jBwhp8OMqqH5OMcWh5RuHkeBT3BVRdBXboYBsX5Cn+YvmqfNQ5dN/Wrx2wr1Dj3Wqu0XR0/eA4d+K/AqplOcndgbsCn6MnQ8fG849ZbaFvK1FuEBUBzqOUZlHC8FVfxTW+L/QASvsWY+WzZWhHkYZ131lPLKYLxtK5NUG6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Wn14atjuUWOqvsulZdjaKbtqnyaFGIdB779hCy8M1HF+su9XMhn3/9UnY4TWedx9RA+MEQFk1nIxm20RHBSfpJxDTO0SFiI4EOdBCvQX8ybO0Rmpfm5X8ZcFHByYJpOY X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5G1zmAaIT5weWiPAA76emaPVI0t4rIFTxTr7lFHXhLMrgImkzbUzRY8IVoJgr1hw6/RzM0OhvTM6NaZhVZhC65hUiI0A5UDOIxKy2j1YRj2DwBps+a7VW6+ZuUofjSCmv9eQYUjHQcJl3iP0vF5fDjCccGVdnSu4ChuNfqwqhQL8OB2j6ITM3Ad7Ld2bVOh3NNk27QB6qT++3C16z2TySc4BfeVrYPZ1Q1vrRsomEMkJoqM8oDdZNskMmPWPFlGjjZvVLN1kNczq//5/d6Q0TTcfoVN2NOcvOa2g7lwJ6U6sjEPhOAqAhY2py4eFwMZ8EG7qu1pj7wpHT/jKW9RRfDdOXTu01iXrjNHPto0SCY35RLknNhqOfP+oCe5A9C843PKPT17RGGmhrXX0b0jViU5Uk5TfMnGLB+veId5grA5n6sCw1meD2HWeUCYuSD516iSW8QoJ7UYXLpQaRjtisvcqQlXxfNlnq+T1M36rkl3vykhzAd73afJaRelkjsNnIf7dRCIRreVl/75YfgOiTg/8NAM5IHMY2Ywy/+rU21Ii77Lb/RaDNNzNvQP31UW6vKAfJKhzpd/JXBXHfFWmq7dOc94T2Dl/x2IUJb5E65gEddPk0/5k0alyf+I7guhJ/Wyat+Jko/hv3g9nW4QHtKgJEUDkNpSHCSsOKWzDg3kR5F6JqyygtmGy6WzU0wW+eG9wlBZ38QQbSPRdBIu4xiNQ5adydMJoZvhcvOPUsbEfWzNV8Rv8AbpwFU411VvzaoOkYXbhE9HSd7H+Z7EJWA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14be4b34-335f-4304-4cb7-08db8f7dae8c X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2023 15:16:56.6715 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aUHdrxl/oFeirr6MgZTHmChBNWVPCAh9qqMbBn8gRTgy72JCDfTzUdeGHmiUAQTbnMk1ydw690l3cv381lF0fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR10MB5930 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307280140 X-Proofpoint-ORIG-GUID: lRCb5jh-XlDoIw7HC9PeNrTJzdu3cWhx X-Proofpoint-GUID: lRCb5jh-XlDoIw7HC9PeNrTJzdu3cWhx Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org fs_devices::metadata_uuid value is already updated based on the super_block::METADATA_UUID flag for either fsid or metadata_uuid as appropriate. So, fs_devices::metadata_uuid can be used directly. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8d6d7c23d37d..b42de42bafb2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -313,21 +313,16 @@ static bool check_tree_block_fsid(struct extent_buffer *eb) struct btrfs_fs_info *fs_info = eb->fs_info; struct btrfs_fs_devices *fs_devices = fs_info->fs_devices, *seed_devs; u8 fsid[BTRFS_FSID_SIZE]; - u8 *metadata_uuid; read_extent_buffer(eb, fsid, offsetof(struct btrfs_header, fsid), BTRFS_FSID_SIZE); + /* - * Checking the incompat flag is only valid for the current fs. For - * seed devices it's forbidden to have their uuid changed so reading - * ->fsid in this case is fine + * alloc_fs_devices() copies the fsid into metadata_uuid if the + * metadata_uuid is unset in the superblock, including for a seed device. + * So, we can use fs_devices->metadata_uuid. */ - if (btrfs_fs_incompat(fs_info, METADATA_UUID)) - metadata_uuid = fs_devices->metadata_uuid; - else - metadata_uuid = fs_devices->fsid; - - if (!memcmp(fsid, metadata_uuid, BTRFS_FSID_SIZE)) + if (!memcmp(fsid, fs_info->fs_devices->metadata_uuid, BTRFS_FSID_SIZE)) return false; list_for_each_entry(seed_devs, &fs_devices->seed_list, seed_list)