From patchwork Fri Jul 7 15:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305075 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 7F98EEB64D9 for ; Fri, 7 Jul 2023 15:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjGGPxE (ORCPT ); Fri, 7 Jul 2023 11:53:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231594AbjGGPxD (ORCPT ); Fri, 7 Jul 2023 11:53:03 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7137B1BF4 for ; Fri, 7 Jul 2023 08:53:02 -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 367FmOxK031722 for ; Fri, 7 Jul 2023 15:53:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=d1zlSyJu75TRaqMwq3sXDNKlw3NKDdbbXjl/Dac7d74=; b=Kj3W1ryTtoCvzFZWTmK1tngZwc0bOFZ8GJ0PVlWz0GwCPCT65mOXeU8yyu4iD5ysuDRx rEq8ppA03415hVShspkk92K42K4lpPLb3R6dwO/eWxYHOuQ5+diThyzfMI2lnBNSbcZs f7dDgIWHmRRcUQAYv6yWEKBQ2yPfK/iH5ig0EsOhoSdkZKui6j1skDfKGn+U4f6XN8iR 3fOPF9Lo8+cTIGq/qQxjAzB2vhc1Goj6hHZD/5OETfGc3NlsLowOvwSrcKpvBKy9YpdW n1dBMV/vev34GVEB5YgQBC4b4/lb/d9ao6VyxExHWdOSZWsFS0ktMObTBGCG6Stc8PDd 3w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpb4xh6yy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:01 +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 367FeNVv010256 for ; Fri, 7 Jul 2023 15:53:00 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2047.outbound.protection.outlook.com [104.47.74.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8kfh0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oVZ+PrEyOeWixvz8WGX1F8uEOwwSe4mlGZG6ICNNBcsRtvxkeLxqARK1P+a+7WyeF1eyCZOKo+bRsvserlL8WvY5rTT2w2w7AcLXm8WWkYl7CejaWzTOuI9ADWgp8fR5qQTOlNzrU4iwCKHdM6rc4OKyPoIHrg3tY2bPPVEjGoeOY+nU1H//aUBeK4igA5WX+OmEaqy4XB54BREz/IbkrSdpB9KKKRVeOQcodIG1s/tVPASh4KXoQm2uejN/94CPDpieN3EFH814bsBD0j3ey5QDtkziXe42YfNVlzOBglwFHPzLixtag01GjHsNoaCZojJKrMwmv0L/nyyMu/4YUw== 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=d1zlSyJu75TRaqMwq3sXDNKlw3NKDdbbXjl/Dac7d74=; b=Q6E32Wx0Utta8FPO0QvgQ24XtljIGQm0rkxekrmBeShVgQ00iLw1UC5ldP8A8vWm8LsBKCUgZiWaBNQdYc99CkCpkspDVaD2ahM6MBf50Z3Mrnkz3NPrXU3xkGT4ErMWA95nYByyoEV0ORnSpi4U1Gi4NW/eVnxEmiCmvCu7b7JVjZNP/RPdKdJJBUReCA92mLx02ePcyJqO5kFnbFIQ6r67+CTM6DPAdU/LilQDigMSJbZjh3WZ27ZwZB1vNE9lnd6dvnerYLZ1JUDOdITWVX0qfkLaUEbZ7qH+AbVEjGURyFUyMoNyoyF3UvwmJrYkH3wkug/J71UKKFp8aGoV7Q== 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=d1zlSyJu75TRaqMwq3sXDNKlw3NKDdbbXjl/Dac7d74=; b=KSgFgML+7O5vyETviBoUGQ+FyY5Z7Md8OWwEDzTsMOCRPVEoa4mUo27nvx8XbTiyaWSnFbjfCcEb3VKMt93SGIq2lhzUxNdnspzphMI4AGJVlDTeFWUNmKGDmTqhLSivobW9u6HhJoexXHdVfmqKYNwPVr/XqxZp125CdBxX9G0= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH7PR10MB6156.namprd10.prod.outlook.com (2603:10b6:510:1f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 15:52:58 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:52:58 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 01/11] btrfs-progs: fix duplicate missing device Date: Fri, 7 Jul 2023 23:52:31 +0800 Message-Id: <76f85159f72bfef17a702295086745bf31fa09b5.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0003.apcprd02.prod.outlook.com (2603:1096:4:194::13) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|PH7PR10MB6156:EE_ X-MS-Office365-Filtering-Correlation-Id: 4283b207-9492-4819-5c48-08db7f023c51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QNhU9+5ruT7EXaViu8TkA2klBuGshypL2IIQ6OLoUVrn907iJ8hycnSE7llKitkukXAVZfdjhpHOM3IW+eYcHj6OWFrjjOO1V7ywipttdoLjmZU0A3kuLOiRa9J76JsoVLqQRad75aTkIhUyKgNrnsFcxriwibtt/gJDGUE50pjCtZ2yqqEL6TYUn3p/JuU2jQGyrYr0c4ORUVp99Mp2tRFDrsfKzI/qcuezVK2vjE0irKBdBf/Ow9Hu0HNXMXHq7vSvEMGdgpMY6T6YJLThkP3Gmq+jnBWDWZDYPCm68FrU6KkbSshu/RbA3rY86c0oVop3HHhLhU/2ItIZcr+n8PvJOX7jYXyVCKvGeOv8Vx5TcOgE5a/bQYFANjZ+o8KoEWAP0JIysqSLBGOy5OI4+FjI690JXo/lkw8cuajiWIYmiBVaWp5TpxfSBFYGPnqcyEx3gj9ZnWaD0C8hMbzJjRwUg5tU1UBw4/PnOHu5SFyMNQBd9OxyMirJODQ1Sy0wBezk7H9Ol0QxxYxu0jq4XinTEN22Ts/kLCvZciYzVQ8gpw05vA8Fv88a5qCbhmVw 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)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199021)(44832011)(5660300002)(8676002)(66946007)(66476007)(6916009)(316002)(66556008)(2906002)(6666004)(6486002)(6512007)(41300700001)(8936002)(2616005)(26005)(6506007)(186003)(83380400001)(478600001)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d7OBnxXNPeQiIVSzie2WsEmPMwJUeszRB/PwTfi56xRmNURvS1b9NbYMSwyvCYkpzJB/PzVh/QYw8VBxopkZAuzfbKMAN6ARge0G7bsm0k+SMwaq6MTCuhzY35GY6JywJTSqf6h59Q83nUnL/txUnUC8T7AwAkapADaqQI+/eafyZp3WG4jAonDUnYYGRIzrevakvoOhyXuHAzH2aK/EkSarz1AcBBx7B0wlBERVvqYlppp0JkmNOAsTpfCkMbE9XaNzT8aLi1Cvu9SY2HzPIH3TiWcxs38ntAHCB39VgGYunuiVUgmK0+koJrF5NUNPsX8DN9ytgVBN12sm7s2RuzToGhXZfLGtLq/1pMuBoRPe3pzVwSlG/4qAQamj4uFIkH7C/B2D146Z0IE52UcwdSMUSKJo2OU3A0vZaF35uR3o/UUB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5d3w66PDdRIVBd39dfiRgdX5SZPp9X+EP+q0NAKN4I/5a7BVZvEzR3+yE1GNJVYz6d5Jqx7QJr1knXXj/5cuI5gNgS6 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LzNSqYv4Eye/uAsLd7x9Qc5SY+yYPmQX075H/VBY+W8SSn3b1Z9rfjR6KiSvIMNmHNYo7wjSVix4Tcb8SrbSb2gr6OrjTknGufjDFXZOSvJZi7qLmR2CX4YJHdKG03Mgv2EZtw8zUYiNeqLM6AJjb9ZjH+LNX3whCg9EeQb/+IzmZ0U08b85gR8p+scSdo3U0376ZmmYoK+4WEk1AXELk0sqMYZmxjlekKCEJ4+S+/qt7WTea++BbAUOiHSukHWEvJxhSNSclXR1gdE9abYKqdj3ndchecbolxUZXNj54fswJuJ4wcnra5EUbXemAj+wv8G6/Zldhi5gYZx0IF1wQse7GWtJ9AaKJHVZKVcioVJkmvWf5i5GiN0yh+qHHAN9eoJMQF0GTQs1Tb+AAqtlIGa/DLT61SbPCgnSg4Or1n9+mgRjOWtxsyGogRkVwk9fyAI1SDcNTbytWJ9m9lAPi3j3iKyomyG/KChMORbvyIQXtOOMfWOCdwQNARnLGRNnUYbqirG+4WRd0Y364jwFlhozmH06KT0gVh8dPDnAFjiOZ6bRTNlhHtn/3NikiUrQuf0qSTwMHck1Gr1iOncCW/PyqTuA4QdwDo/ToXA6vh3GWGbiQ/oGSztNHw+6CS8euB47nJ3BgJvJusO/H3sc9fPTQxqMf5B9xxWDdcz5BEV2bAM3rC9mL1w5JkeIkz7ACVB3/ZZMn2Oc5mk9fsUFuPpWMxNe8s22vbx9ux95M3dN/Ke6RdU++5+5nOBOHVva X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4283b207-9492-4819-5c48-08db7f023c51 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:52:58.4308 (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: ec9oKQxQoqyX+8zvGAJ43Z9T1czo/cIDBvp2ona1TEryOMgPZ4Qk58S9/voxym0ZoltYAYI8Ygbw3CQ142kXTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6156 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: uEPnCSsrLbtTdUUT5xb72y_lLP4SvUUA X-Proofpoint-ORIG-GUID: uEPnCSsrLbtTdUUT5xb72y_lLP4SvUUA Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org btrfs_read_sys_array() adds a device with only devid, but without the device UUID. As a result, any subsequent btrfs_find_device(..devid, uuid) calls will still fail, resulting in the addition of another struct btrfs_device to the list, as shown below. open_ctree_fd() :: btrfs_setup_chunk_tree_and_device_map() btrfs_read_sys_array() read_one_chunk() btrfs_find_device() fill_missing_device() <--- dev_uuid wasn't updated list_add() btrfs_read_chunk_tree read_one_dev() btrfs_find_device(..,devid, dev_uuid,..); <-- fails list_add fill_device_from_item(leaf, dev_item, device); This ends up having two btrfs_device for the same missing devid. Before: There are two device with devid 1. $ ./btrfstune -m --noscan /tdev/disk4.raw warning, device 1 is missing [fsid: 95bbc163-671a-4a0a-bd34-03a65e4b338c] size: 120 metadata_uuid: 95bbc163-671a-4a0a-bd34-03a65e4b338c fs_devs_addr: 0xdb64e0 total_rw_bytes: 1048576000 [[UUID: 703a4cac-bca0-47e4-98f6-55e530800172]] sb_flags: 0x0 sb_incompact_flags: 0x0 dev_addr: 0xdb69a0 device: (null) devid: 1 generation: 0 total_bytes: 524288000 bytes_used: 127926272 type: 0 io_align: 4096 io_width: 4096 sector_size: 4096 [[UUID: 00000000-0000-0000-0000-000000000000]] sb_flags: 0x0 sb_incompact_flags: 0x0 dev_addr: 0xdb3060 device: (null) devid: 1 generation: 0 total_bytes: 0 bytes_used: 0 type: 0 io_align: 0 io_width: 0 sector_size: 0 [[UUID: 1db7564f-e53b-46ff-8a33-a8b2d00d86d1]] sb_flags: 0x1000000001 sb_incompact_flags: 0x141 dev_addr: 0xdb6e90 device: /tdev/disk4.raw devid: 2 generation: 6 total_bytes: 524288000 bytes_used: 127926272 type: 0 io_align: 4096 io_width: 4096 sector_size: 4096 Fix this issue by adding the UUID to the missing device created in fill_missing_device(). After: $ ./btrfstune -m --noscan /tdev/disk4.raw warning, device 1 is missing [fsid: 95bbc163-671a-4a0a-bd34-03a65e4b338c] size: 120 metadata_uuid: 95bbc163-671a-4a0a-bd34-03a65e4b338c fs_devs_addr: 0x161f380 total_rw_bytes: 1048576000 [[UUID: 703a4cac-bca0-47e4-98f6-55e530800172]] sb_flags: 0x0 sb_incompact_flags: 0x0 dev_addr: 0x161c060 device: (null) devid: 1 generation: 0 total_bytes: 524288000 bytes_used: 127926272 type: 0 io_align: 4096 io_width: 4096 sector_size: 4096 [[UUID: 1db7564f-e53b-46ff-8a33-a8b2d00d86d1]] sb_flags: 0x1000000001 sb_incompact_flags: 0x141 dev_addr: 0x161fe90 device: /tdev/disk4.raw devid: 2 generation: 6 total_bytes: 524288000 bytes_used: 127926272 type: 0 io_align: 4096 io_width: 4096 sector_size: 4096 Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 81abda3f7d1c..92282524867d 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -2077,12 +2077,13 @@ int btrfs_chunk_readonly(struct btrfs_fs_info *fs_info, u64 chunk_offset) return readonly; } -static struct btrfs_device *fill_missing_device(u64 devid) +static struct btrfs_device *fill_missing_device(u64 devid, u8 *uuid) { struct btrfs_device *device; device = kzalloc(sizeof(*device), GFP_NOFS); device->devid = devid; + memcpy(device->uuid, uuid, BTRFS_UUID_SIZE); device->fd = -1; return device; } @@ -2150,7 +2151,7 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key, map->stripes[i].dev = btrfs_find_device(fs_info, devid, uuid, NULL); if (!map->stripes[i].dev) { - map->stripes[i].dev = fill_missing_device(devid); + map->stripes[i].dev = fill_missing_device(devid, uuid); printf("warning, device %llu is missing\n", (unsigned long long)devid); list_add(&map->stripes[i].dev->dev_list, From patchwork Fri Jul 7 15:52:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305076 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 3EC6AEB64DA for ; Fri, 7 Jul 2023 15:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbjGGPxb (ORCPT ); Fri, 7 Jul 2023 11:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjGGPxJ (ORCPT ); Fri, 7 Jul 2023 11:53:09 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2052EFB for ; Fri, 7 Jul 2023 08:53:09 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367FiMLg007053 for ; Fri, 7 Jul 2023 15:53:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=EuZZ9iJ8fnEqSWpbq8FuuZXci0LOStW+ZdK4r2F6cAU=; b=bGDEefqRUFDFiWNcSIRan68NfNb7dEj+LdTTx4YiBo6bNTsVLIMiS78Pd5qjP2vY+iJ2 z8+Pf6y8ux7mZFtuxe6t8zttmjTe1nqQcVOiuxOHq+A3p0mtXgojgD+xAkXFd+dMJo3e ORsqiZjJqFNr+u1UQyIGd6PC/0ECQhIylR/fXWshCE8drkJx13pKzzEcr07S5t5+pDaU yifTAGCWUhDcuQ8e6bXEpFA73snwW+C9izYMil9OWwCQm+4aXjOuGGMI+v/hZ2vSV8V7 GlmJHY0dMIGbXbJ37ZlNkac99/2KCxmWjkuVklNPsSZiJ/KuUdiIyJyVGQ4G2ItWG2Q4 jQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpnm0g0q4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:08 +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 367F4hwP010374 for ; Fri, 7 Jul 2023 15:53:07 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2042.outbound.protection.outlook.com [104.47.74.42]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8kfnx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLlTatR3+2FY8N0lFLMCYIqvJv73ADkNJMZtX12jg+Iu/6VE09ck+NZqMLWC1qV9jG3eFBWyoQMlPwAhOWQte/YsYaN1vGg4HXYVTnTFAyyoxBDPyOiLEniCP2wdDd3Jgss7vsMAfvGaPpiP73SMA0c7w+xGSxd1Esi+TVNuh76ScdzQQc3lwN/DyKsvjaqMW2hYl2BYosE+zF3m1Ay4OjQIRBcRGQdW2qjaF45cX4cFLRl+I/B5X1UPgfBzIYjFeMxhMTP2qiXAp6CtRk13ctUZgoCGMyb+wPDVMeBymEWnxT+p7QWmKQqfdD3UNcyUwWACZBSjgKM1vM+oGp3GZQ== 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=EuZZ9iJ8fnEqSWpbq8FuuZXci0LOStW+ZdK4r2F6cAU=; b=PvsMyyDM/43MF9Dj2WrNS9T39PMe+xFh9ZZCfNP6OOs948jVikzq/DAHgMbpHZdBSujbbFhqtqJy4bOUU+B6GGnxfhIwHviKReBOb3V2i4ZE6hczUx4zgvpMtkd4uWLWp/087vRx8EYcMdx3d/IU2bolU5WIKJ/TlfFg02/3pQ5RoT3BmUs8n10GBoAhK22b4Px5b2HvIGJPPAllq9lMcJ8jviFA42o6+UskpazTkCwi3u1TzAoWxUyIT+pLLiG01XG2I7CRUoSmqIRcpPHIaZYV8oDLky8tbFFC253n8kmsFSq18Jw0yZ14wE0jcsGP3uKbqwXCBYJuw3SXiO4+3Q== 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=EuZZ9iJ8fnEqSWpbq8FuuZXci0LOStW+ZdK4r2F6cAU=; b=v8o2zZ6+ouybxYjmUjPGheY7tLwgLBEd1ou02zV4d5z3UgbDGjTH3VD0KYCE1LF1e8mJICeM2TeWZnJTe3NFj8hbp2opvKFp8cWylfXjTXh89VPZgzRVZmtF6mxmUO7YnpPb5L3l1QznWvA9F31k9ERksMZbgK49d46B82ZXH7Q= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH7PR10MB6156.namprd10.prod.outlook.com (2603:10b6:510:1f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 15:53:05 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:05 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 02/11] btrfs-progs: call warn() for missing device Date: Fri, 7 Jul 2023 23:52:32 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0043.apcprd02.prod.outlook.com (2603:1096:4:1f6::19) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|PH7PR10MB6156:EE_ X-MS-Office365-Filtering-Correlation-Id: 6be56c15-1234-4b64-a977-08db7f024060 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vveXZOkczywyt1hTCyVrB2BApOn3JF4s8Myk90fTI54XCBoGIOL8Zq1FYZCPg24y3Yg0qu0Jae27+EKaOD7JRUiRM2AQG1/LwDXt/yQOOWvCW0QiN7JDEFEou5/XIt8KCsvflbOW4+a2s3qZlTmvLrAZ7+uJoNO8ikwuZyPKU2NVya1HwG0dkTLA6wE3BrVbaSFwh42E51Jir69HxCO3oeuH5HtSrj79yNOeC838plUXiTR60ZmuNmzenfZ7oJZiiNFVrlQQV0Cbuj/c5ZPlr9kRW2BvJdpGkbO+l1nOub2SPfNy7VMmaXshyQcq8emk6xV0B1bpnBpfWV3kw3f2O9fezQ7yqWhPBtX9Vwy3ACyrxWUYvw79SGo/UjywEnVruHUtD+RY3IqWio156OF3PJfXGCuAhTESwUnbgMTfWRkVtvwSQil8TPzJ57wWw8v7FsiVhbfneLDAnDm8CsbfoPBl9lNCH6Ibr46aLqhtq0pIuIPPKOsL5+Y7j3BzsjThtH+9H0vdyw7CPHpRZKqIJ42qdlH3xoSWzLpxXPCzmcLD4NMwWHRMF49oC1Uep0sY 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)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199021)(44832011)(5660300002)(8676002)(66946007)(66476007)(6916009)(316002)(66556008)(2906002)(6666004)(6486002)(6512007)(41300700001)(8936002)(2616005)(26005)(6506007)(186003)(4744005)(83380400001)(478600001)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6NVBq4wvMi9jx18P5dkAIN//wunilLILqN0KvDtwGirmK/E2GDw3eu/+5RiBff+YmEHir/7+ePdPkfNqBMvD2Wzmjyova5DuRqGjl9ujqTzCzpHmQAtCXonopXmZTyvwZ4ON3v7jjIXlCXNv0Gy50ZrglA6CbirQ4IFXxd8fw2Oh+eomRVqFo+riuKf16jyAdgeLlcdB4CNLgQdlw9a8b9iGFJKwUJVDOWrVtknnexdkSeZhLb841HNog4BbKHGIE36+Y1h58XVt9VrTK99M6oNRt7gbAMNJN4XJQqRK23NpO1kMyemGJerpyd6i+IcoZJqmJJFRD++BwdhSTZY92IS2pf8/+7MOd3nspLv4O3zMGdIemB6rylVfn6YeKoTCTrnG6exSfaclqCRlun6o8qoEPsbn4skja9M2mBPBTUlZCX3xl423jrVO8GdW4ycDKUCMUVLbRemn8LlbIuy5a4lzHzJb/CsG80vGBlSoY9MLFyQyfZfRW0aUPC7r0U/TobCSHIVzeBUrMVlA3UnQoLYpQVyP3/ihtMW8K5TQYLo109Z6mHAxrV+anZPP6LHXfdhHb497EEidNPjgEDLfzliTq/+PqeSbjMi9XNipwwfhzbH9V4wiEFnB4FWEg3WgCpf9UTt0aufyJXkv6+3vZz74hWZawOUS0fGfosnaKXbK7E4w8mGZZGM/8lwJbKhiMRupwCdqsqvIsd/4gsi1AAOMLwj3+JK4DZOE5LA9auo95zCRrIDuf5/0Wa2o4ATb45iyqcT0p7s5G6rtey1Zilz8okBHaIKzdlLxE+HCFLeYfuWRGKcedB5FjJHqE+N0N75njXlN4iy3EI8VmVSyfEwoVuDt4Xt+OVgblY7oKsrmu7mOnvY0tpV9xC+AAlE4wiG5PFLt6Le6b3cK0e5Kjj+Jj+tYIDUxO1XmxeGv5hpc2gEJQzH9RHmHetYcj7wtVarN9rvYwaJkzXKwDI7yqNu1JlpMWhlkMAbqYXeT+F0xJ9P7sUxV4peO6+10/6Fkqm0nLfloCOjkvCNr0AMBES1lz9xhmM821artasAuxCALYz/otHAV3VGttwyjdmx6EXpzp0Pmo7oFtjiyZS9JTXpbEwpZt1EMzZyybfeu+WM8B6MrLW0P970+bN7F81nyB8d47EObJeVR9CMYIEScslzh3Eb+veDKIgbFuVrNhdSjlcOJAZkSx0+3/N1c+jJMJFkJuiU3p+jsHMTD0s/7IdF78KkQo2TsTGTm5JlJ3IjAnGj7NxNDxrXnbq/H6LBabjON3um48Jrt7bOJja6mFRKML75gq6k1CeZ2i5jpB70ju0LTgPnRdBhfhfPG0lceEsyrm/QIqnBBzAVqaTZaLxcsC8RuCzwoeHGCM68ONpzayWUtOYLi6gt6ewEP8jjlCHjpsI5vLyEpeqBnNTRGjHPAaYhMUFOWPHduQQuQjyj0vyqSEpca3fNIhEcih01yar242otpTKA2TTNneW5Tjae57AagXJ4L3jbrjUH9XKLLFr4H8LBvV3VeId9uKIYozO+S9wyHzxSpKUQHJGLAia/UfIqId4lrQPMcpBhTYEZsPLhb19a0pQny0K7t7IfA X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KmKOrQ9+1NcFXAKkkDmIrisAQaHYfxPjO5tKSMmINmY0o7OfZfd4gvIJ7R3ykm2qLBFs4MDgefQmts3kb+hAEcpLetvXktSMlOWbmrX2BR0mhLumQ4pryFG+87ua82/RKPiTetA560ETYu62pN7oQHL8DrFKxIrxG92fGTVxtc5Gg9x51CMwd3pXjfVKPFOBp7D4FwnbDEhS3e5yNpBZyJsIZm217/RJ7lznNUbF1l03dWPzCPUuONSpNLSbeCkHrFNRIy0zSJY3MGhOaFaOr79/bjgBtO+E+4VAgXAril4fdKCMOxAwMOYR5xryjYqXnm+3kF/xXN5ZNW/Pxv6K/9RWIdJR3Kxwh4tH+RjuboViTc9xy8CndeiuCNGrL35aVHTDtaOvqEn5UwZYb2AgoeJwNRTTDys53M1Ac30AIp64XRB/CL/G/24JZXCBTZEOBlKAPdULnpAP+X90oQFDfrAaab7yYkaTLKTCl3t+r46XNfMBUkQDW+oI161uUeOl8gcg1jGXeEa5P3xOF1HqL5fERz8CDZMec3C/ayiP8AKG2OP8ipDfD2E+WSsJKY/WlWEvji7LO/ojpq8FGZFCoOsFfxhP7cDh6+wEcP5HdY+NKI81xmw2hVoWmMzOFIv7kgJyH+9lNKE08Zt5sg0+59HQALdXQbIAgzjlcX5XvcP08sMTy6y1BabovU3v9xbC++8YoWrAK2DRCHezolVTyvbro7khB15UOxvzC7qSbIzfkFk690Ss9CXblv89yhlv X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6be56c15-1234-4b64-a977-08db7f024060 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:05.0669 (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: Wy080V2QRRScgm0z384oSiyVhbBxT4fOId6x74XWXL7fcim4HaGNqFIUVt4Ekytsud+AvRCrq30heOL1ScEUaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6156 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: haNzsOMKoRYQetLv_MIjlG1e-p7wYook X-Proofpoint-ORIG-GUID: haNzsOMKoRYQetLv_MIjlG1e-p7wYook Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When we add a struct btrfs_device for the missing device, announce a warning indicating that a device is missing. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 92282524867d..d20cb3177a34 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -2252,6 +2252,7 @@ static int read_one_dev(struct btrfs_fs_info *fs_info, device = btrfs_find_device(fs_info, devid, dev_uuid, fs_uuid); if (!device) { + warning("device id %llu is missing", devid); device = kzalloc(sizeof(*device), GFP_NOFS); if (!device) return -ENOMEM; From patchwork Fri Jul 7 15:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305077 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 1C1D1C001DE for ; Fri, 7 Jul 2023 15:53:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbjGGPxc (ORCPT ); Fri, 7 Jul 2023 11:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbjGGPxQ (ORCPT ); Fri, 7 Jul 2023 11:53:16 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E00FB for ; Fri, 7 Jul 2023 08:53:15 -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 367FNtdI020144 for ; Fri, 7 Jul 2023 15:53:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zbU81DRnZygZa/2PE68Xz5FLolmzTwdulvU/uxql+0w=; b=D5CPb5XBfUYUb/K2+aczOx4nE0EQuZW0NhFqJhvTrbQ/oE9HGQqQ+BFqEssuQYuMZes7 DT0neDd0sZKLgnWgRUbrs3SluWekPpAjGGDoQrn5KrkUHjVozekyjJNUgeQIsVuTS3aT 5PmBa9h11KJxKKfVvi5qttCMcmXdGR1whSYpKboMwffxwpbFoEM1fOt5KTd3I+h+ACo0 T2R7jzokbKvSKDacTrhISiv0YdXHgnwzY1812hQzpMK0/ZRIefdtV+ND7Waj3pqSBkip SBvRnISPI87I/l1cR+oE09eFw1EThGH8V6AbbiPVLXSDGqGr5rA5pHkN0353cHb9fWrT ng== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpb4xh70f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:14 +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 367FX1Ed007129 for ; Fri, 7 Jul 2023 15:53:14 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjakekckr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OSHsbBMhQtypWQXdPwtU3f56j6eujHUqE+PswqtBye9jMd5kYqxMm9z8XfJRgdvwWoAfSysGyEF3ZpIOHPXZkmV/3W2ydygRnQj/lTo/+U+ZsGgCFLVk138ynQ17TWDU1SBjzKK/bPxaBtILl5//sf1K35YzgzCVptzYClHaO66oJZxvc9JKkmbVpQPqempbBkogDDcwoKrWNeLwywmZ8iIQMIzYK6ft810aEbUIgVPwR497zRtyvAq5iG4A4Vn+9II09LvyJrd9hdGht4irW3iLG0IXvooWFb+CmBdx2binDEC/XXOePbXus6KxBWYicuEMlCMR85X/LKjio5BLuA== 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=zbU81DRnZygZa/2PE68Xz5FLolmzTwdulvU/uxql+0w=; b=UAANlEvJmWyO6VAcmrrqBfUHvhqWlzk7eh9Mpe4kp0jr0pPwmRTiICj6WVw+jz5TC1hYbRrF1HdM8lVPm9khvg5cMeDInoTmISa3ajsYMf88AkWGoGeB5G0AkokO7lFe2QwcjcDjEWOBgJTHsEFkmG76pod5CMEN5BjMjrGVtEL0ldBxpx+TIJyKIJVWa0BWu7NLfXZIFk9G25g3Pgv9jUEEwa5yHUEN6pVkeIYO7PwM7N+0BDaqsU3SIrTAzqEqFjzs5wKk42BNTFF+6oRdbWg0lYklSiEuiEnhYYOd0Zv0MZQN7WQdgNBCa26B9yAjFQl7JN5wPcveDNU3ujlJ1w== 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=zbU81DRnZygZa/2PE68Xz5FLolmzTwdulvU/uxql+0w=; b=zIsUW9nphTh3crrag3AnJihRdLcXiYKByIkYs8bG1/E0uX5PCUaIHSiXDP0cR9KVM7nkZKDXAHZhfH6P7Fy/QJNgTiebVCGwY7JgdV2O1r0pu1LrbWO7ye2yq7Tp05hZdbb6OGDm0Am5FUa4D2XRNVTULeX4Kx8pcjaIKjBxgGA= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by PH7PR10MB6156.namprd10.prod.outlook.com (2603:10b6:510:1f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Fri, 7 Jul 2023 15:53:12 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:12 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 03/11] btrfs-progs: track missing device counter Date: Fri, 7 Jul 2023 23:52:33 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|PH7PR10MB6156:EE_ X-MS-Office365-Filtering-Correlation-Id: c579feea-bab8-4e05-8b7c-08db7f0244ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ir67yt0QgD0kK2BmGltA/zuLvn9NCH4BlC1ywG8E9PQhd0ajmJz46IGnGX8/yZY8poYhXa14Xs7rKYQzrAl4v3Nx7Ydjzh2KF87C9xbMEQIlClPQcRGdGRlnTZE8GdlVe2KecLEB/id4/G/X9aTsbm5rRb4/Q3zqayEXvPPthufF4CI8Y3x427UF3W396JaRsjlzk1tadu4iuiS6F2ry+SqDr+iAZMDxNAlGXPXytMHtAqsmz0u3DPZsPc84QAgqcWO6Hp7GZZXOs9NFa/EVwF3qP5GBSiVWn79glOOBJO84+eBhof526Hvx+MES6V9nsm0v5XNoiftlsPVlj2S9z0fqeSMHkrwoajjEbX0yDAvEcFOu4x6pSmf1EyMQwn9dXerhcRZmMzh6c6GSJtO5CSo8b9rh2dMrwhDxJVH1VtQ37VVaqrla1b6+JRIYMySQUPkQXiui+RK+PblxN5Hy8giI4ZpvucahTdX/Ypg/+TZ27a+oao9ZXQtNSePIqjIriALSQ7JsHJ3UhAtOGq4L74+o9ieB71opCx2kNqJZrnuB3vVzCMdbW7HfHMo5ZFYs 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)(376002)(346002)(136003)(39860400002)(366004)(396003)(451199021)(44832011)(5660300002)(8676002)(66946007)(66476007)(6916009)(316002)(66556008)(2906002)(6666004)(6486002)(6512007)(41300700001)(8936002)(2616005)(26005)(6506007)(186003)(478600001)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nYIppfGUBCfbjvO7Ku5+BOeLYuhWZ/yRdXAacl8ERNMg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OvNKPJ2ggy1F5amVeFixWlBkpM/tY8IiCkI3vaExq9mFHKSyuvFvdSqVCsQzA7auNZaavDojsKzknuQcjBR6KatMBWsQO8QfakzaP0qejIHmDuEP1A/6SEdfw8iXW3/6VoFneM6fkr03ft/m1QYFlct15Vn4ynSS3Z6DGo1dQlem2yheEnT8NR8vS8Cn98lc3h8zOS1q65x2sHX8aZ2nTQ2Ep1KpyAdGj44yq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c579feea-bab8-4e05-8b7c-08db7f0244ca X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:12.6448 (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: ViYc8VaxmhgsE4ub0SJQj6lzXLU12hsKj0ZKMD4VBhsFA0/9Hyz1itYWZQT1TWn9kZjSGg3Th8CcErq/DoWh4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6156 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: NTq1-nAXkwm--AVy7pa36bs878aYMUre X-Proofpoint-ORIG-GUID: NTq1-nAXkwm--AVy7pa36bs878aYMUre Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Maintain the btrfs_fs_devices::missing counter to track the number of missing devices. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 2 ++ kernel-shared/volumes.h | 1 + 2 files changed, 3 insertions(+) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index d20cb3177a34..671396dba689 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -2156,6 +2156,7 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key, (unsigned long long)devid); list_add(&map->stripes[i].dev->dev_list, &fs_info->fs_devices->devices); + fs_info->fs_devices->missing++; } } @@ -2259,6 +2260,7 @@ static int read_one_dev(struct btrfs_fs_info *fs_info, device->fd = -1; list_add(&device->dev_list, &fs_info->fs_devices->devices); + fs_info->fs_devices->missing++; } fill_device_from_item(leaf, dev_item, device); diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index ab5ac40269bb..d2915681e6de 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -90,6 +90,7 @@ struct btrfs_fs_devices { u64 total_rw_bytes; + int missing; int latest_bdev; int lowest_bdev; struct list_head devices; From patchwork Fri Jul 7 15:52:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305078 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 3B705C0015E for ; Fri, 7 Jul 2023 15:53:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbjGGPxd (ORCPT ); Fri, 7 Jul 2023 11:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbjGGPxZ (ORCPT ); Fri, 7 Jul 2023 11:53:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0984FB for ; Fri, 7 Jul 2023 08:53:24 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367FO5kS030683 for ; Fri, 7 Jul 2023 15:53:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=6sVNSHbIzbGCf/gKIRY44ORT1aA4QZ5kKvU9nznRug4=; b=kqKQhh5di+Ax0a4vmVFs0CzBkrMM64OJ70nqaQsN1G8Hs1FD3lAWxZoLHVmeVXd5VXe7 6+yutOQ5UXQXbcFZGaTCLFviARbHXvE5a7CODTWnZRGcE78bv29j8WqDgD3T629+HCWq YGGzWvIz01iRe+6mrpP9RCLXtyntJj6NVqlDwrjeufUwlmOP5kHQm5/7+WZ6vtM7r/rY +Fd15BfpVMLLvYVcVQdTpHD2BvZMoQzd7As24MOhxaclISd6XtEE/3RXGqUyAbxTtWo/ VwJiQki35WVcEa5jq7wwPX9PVI4WbxeJ2AYEjBPl6CidFqZeTcR7CtfEgQ1bBZ3JIXHT RA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpjcsgfa6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:24 +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 367FgnL1013587 for ; Fri, 7 Jul 2023 15:53:23 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8msk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eJ2X7D053H8Eev4an49vzzNtPxg4+42rcAK5yfdM0+488vJLB5rRy4crUFQLqI5PR2ugdeMROPzl2ELopHm5DneBsrmksDmAoQwF/z7RejHShsiFk3xZDy8wKxL05hd4NUDyz3/hh3LTjXkyH+/aWCPc/ql7bbQFGp/MPMboZc4d4WFvGFZcMzFQc4rkoAx5mWa75aVN6UKCJBtUPk8XfpAi6zcFc5zdrvfRqJ9A9O76s7evAGn9QlHjMbk9lLSpb53YTBWVM0suVzxjlB47HOtMgiqdTZFbxCZLwlEh2rSipNCtB7mimCq0Jr2MZMfWRRp9dvHFUzo64biQiJO1cQ== 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=6sVNSHbIzbGCf/gKIRY44ORT1aA4QZ5kKvU9nznRug4=; b=QN3SZTkRT5QZYtEHvBTs77PLXlY6FwfwkJ/oyWnhqKDZQrt0DztKMNiAEGweIU0OI6/sk/j4TKblGOws172aVpV76fdzWbfhTU+8iqDuASvBYZZR3/IBmKYqfkxYROwu89e2StLm7U2k+i37B6hHF6jaMY4QGF4MZvnzhokbgVc7FEYtXE1vW6T+VNSKzNrq2pnhi32XCxgSyrS1xgLX0IuQaqlV3Y6V8BYtAYdKzKloUZFQHv6qhp9/qj0hABzHxDXBvtyRZwYwYAsFfrT15jozD4jVhEc0hhmFY7iiVW4fqV86n9VOcGLbj+uWiuaAQZiwNYxFtfSEDqxL5QA64g== 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=6sVNSHbIzbGCf/gKIRY44ORT1aA4QZ5kKvU9nznRug4=; b=xnmJvmJiqfwYVwvF7nxd7YM6nlYI0NQVdZc3N2KZ4NjLhsd38a+dyg9HKbfn2Ck/0AMkP+K9lrfHl01X5h8zN5nBBRUFOfaysfT1J+92UbEzKv57XYsVbnkiUWrx5EUH9H/FFw1NNdqJ67ZmqzfJOwzreFot6ZrLqaS/OCUEDic= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:20 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:20 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 04/11] btrfs-progs: NULL initialize device name for missing Date: Fri, 7 Jul 2023 23:52:34 +0800 Message-Id: <035575319ab5d70795697847c39453580d581c51.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR06CA0007.apcprd06.prod.outlook.com (2603:1096:4:186::9) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: 04a4ea02-dc25-4535-de92-08db7f024968 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zoDIl/apVP8uZ/SY8gjcymMBrFdWaIMoivuSdwLxUQ3ZGedYZuzKvy5q1lloW38pC6PAk4E48qbckCV4wtPSrX85kMjMlmliQa+cb7NsjJkxmBvxLsLcyPg8ukxihyDlOUI3g/tLJGOZmJTz4mDaLcXGGJF4H0G+5ydf64BQ+kUX7TAjiNmmDlGcy8Vo5GzTOKGbrWTKcAqgcd/ToZ45dML/uIgVYSO8raAXZEfqvh9vhIwr978Cq3IZQRD+qNBV3fY2J4/NeijbjdOD5k+XBR3eE4plhgj3Nl0R2wZ428WTwzpdriMQvHgSXpUW7cMyBY7kfea0YUvn2YINQT8e/QWlGoKgRp9SpF1R/5Lt80gclEjnsDqRHAiGYgw4ZtfiefUXepTcewlR+oqSDsLG1VjFVK7KWiYPBSZm+eRcET9x9YJQ2rK8QtIvPI4jCL91wcEl6SC0GxGz+h5YmW55jWDY1AqH6Xkyd9WXbs4KDZdqxxVcV3tMp1zzasCkVgO5mJ/mgDfYwHVPaSfI+ijaw7VnK1b7Uqm2voDJj565CvWR1Fzq7Y8kFyJpU+d1vG2U 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(2616005)(2906002)(4744005)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z7J3578NWSD5YZ73wSkyFx4EfOQZtkh2RURdm9Tn6xGw9VBkgC5eZiwXvfeTzLDPSj/cw/yz0RrDyAKhpEXpG4Q7Qs/VpI6M70VA3nbJxU+GqH1afmd3bd0U+lGczNLnMtrpK/wMt3f9hslgbYLdHOt8nLJ0QGsKl4Szf5bdib4wrWlJ04zjMYvIe+3IrrBP41eT6HRt9hTuxXQFwTF76sAqNXdNFJQEWZCWsC7tekNr/Xo2o1UtBPQij7WDkT9xrp5RH6vbQ0dZWxughOMhugDM7j4og5cVW52u2lz59ENXPHO1lVSECQGH1jZFvkiVuTE+zLBK/z9yv/RBe/s3Qng5adTtf/EldDEZafMEdET7JBAAdZPR//xkfUWqP/kuhBwsoKOTRUfg1Luwigd05t/5bHywqI5jPdz11Qm8vJIwloPyyIi+CL4R4ews76Bi7iXoPDNoHrEgnGmM9B+nFCtDKBkeVpzPfXrfxFeaBw09C7983EMxUg4wTHDs2ncjsDOb+bhFNkjnravYzexalj0pIWed7x+Y3/BMn50U8N5tJwRa0nOtXxb4QsPClWcEIM1w7FaChFMpeDHY5ZbHnnvzpeG8CEVTNyNVMN2ITyOH4yMo9vNlBQDZeQw66RIiHb8fpvbkp7ump64xDErffIhsJmgBa8ibttW4G8D7NsDb66DXT7Qmtw1icvDmOqh5xSHzQ45JxCcYk5LUpglwD/JMTXNiv+1YAyR0fSJkoSaEp+inW1MZFY1IbMCeEfoV5BlW5ceKVIfFNFtm9wpZy9jJpV3Cmwvu6Rgun1BMp8AMdY1+spHclM0IqLvKqyMlw2VM4TGcmkEzAeMDGOJ9/G6Nraj/sJMcS1JL2YiVgG0udNdKJpESmyN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ZmO8Drs/P8f9Jt2t1qjJMFhyHqto/0FN4FwsVTVNW4nktgyr2SLCAWJjawbQyeSt7pfHI0lL5/Ng1yPIvqvjyjvpw2k6rWBe9IWUzQVipvZ0Bx7lv1wi5vAIuJQw5nt9PmU7h5ZVrqja/bencg3qvkZs6vnLQy/szN9T7nWdAHngUq33nF9seRM4VNtdpHJk91Ps5+V010L6cnhwkBzVHjB4uKYwoxXgBDLVyQJXsw+BnPrJGZcLN4oift5io+Xnu/Fy0dBEgblK2EyzW86eI3MC5Dm3+r++6rlyoCX4Au1BHza0vel2Tqzf7QtQwzsG9xBp6vNc5MZebO9XcF8Ec6yPXxJAPO93FZn7YWbiq456NBb1WRC3G4s3Gc+KKCs3xbbllnCG0jGoeC6HZvdrfTubRXzhYYsdEQcI/25PN6FfD9dMb97pkeDpIvIWfo6W3lsPx+FDx4hDOOoyTtSp6Nt19/P3ewzg0Om1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04a4ea02-dc25-4535-de92-08db7f024968 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:20.2308 (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: 3StK+0BDYuXMrkRJm0SAwCq4YYYgjSVrvYND4k/5tMO53wCByLqU5EocDchLx8UuTqyTzATJvdAqkL3IlE6WLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-ORIG-GUID: -PZQdMA0eDmbhlyrFnYDOyzg-1hgQhZK X-Proofpoint-GUID: -PZQdMA0eDmbhlyrFnYDOyzg-1hgQhZK Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When we add an entry for the missing device it has no device name, set the btrfs_device::name parameter to NULL. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 671396dba689..4a8c559d4b20 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -2082,6 +2082,7 @@ static struct btrfs_device *fill_missing_device(u64 devid, u8 *uuid) struct btrfs_device *device; device = kzalloc(sizeof(*device), GFP_NOFS); + device->name = NULL; device->devid = devid; memcpy(device->uuid, uuid, BTRFS_UUID_SIZE); device->fd = -1; @@ -2257,6 +2258,7 @@ static int read_one_dev(struct btrfs_fs_info *fs_info, device = kzalloc(sizeof(*device), GFP_NOFS); if (!device) return -ENOMEM; + device->name = NULL; device->fd = -1; list_add(&device->dev_list, &fs_info->fs_devices->devices); From patchwork Fri Jul 7 15:52:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305079 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 EE088EB64D9 for ; Fri, 7 Jul 2023 15:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbjGGPyC (ORCPT ); Fri, 7 Jul 2023 11:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbjGGPxi (ORCPT ); Fri, 7 Jul 2023 11:53:38 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AFFE1BF4 for ; Fri, 7 Jul 2023 08:53:37 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367FUvpn006675 for ; Fri, 7 Jul 2023 15:53:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=X7WAfB1bH6Tqf05Gha7Qo3knwnkvWWywnQB6BF/4AeQ=; b=OFiqct4Rg4JOiMz4oxq5IPRWcYrMSqAE86RnEq39G5NQue3BoNVpo/N9g2ixHFvP02iM rHQ2dwwcj+mJRbi4uuodKPoDChQWtj4wqsk9MfGvd0+No29Fg8zHBjYVRO4ueoNdk1Hu HY6wLTigzt9EsNVtGoO1uXdopU38TVSPkK4zCiu22sV5muJevj9sL4NuMl8orr5PQISV s//469uBnC+2gvkjPzMQIIrGuIlQpNKCe8d39Zg+w9OK06S2axQQn4sb1XaFk6W6OYVm uYMXuh9WkcOFXMYnHqWopYUL6HMKgoq7xGH9fPAZpBqK7lQYl0TgIxmdccfJg4QOH6VY hQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpmk505v9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:36 +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 367FgnL8013587 for ; Fri, 7 Jul 2023 15:53:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2103.outbound.protection.outlook.com [104.47.55.103]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8msq2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MCLHQNCmmxiP53uctwVUSTY25NR4gfMi8rZBW2i6J98gcJfxEwP/kNRpkatRelvgSxeRK9OJQzwqaOKi6mirqAwzkRvylAvWwXLgCABA1E/g7e+0t/ofzuT/OaJiwS2xUjSgAils/4TP+nQqtgfrvCJoWWO6aLHaRf13+C/8hIAPzUK5diNTlHZ6i1GaWCZs3FRhcoVfqZDH+GKeW8Z/qEQzME3eb4vQ7F5mq5MkBFJPW7PbBsdyKlxZk/d2SMwMhiYbYWwyYcsQAnkZiwR5Lt5NsRPR8uYGoFzJvPAMLSKsPXBcdV9ADkFSrwTOTNmLedWKxYq7R/pkIRzfROHC8A== 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=X7WAfB1bH6Tqf05Gha7Qo3knwnkvWWywnQB6BF/4AeQ=; b=UbQW5yeH+lbkiFw4M5i3HcUNHn1ZY+XCXX2EMK3Nuqi3Rk2x0nAPLV3s34MVSCAOGflgZQ3EvMmOZWrAswUKQmzsaTtzJucaFNBP8EmTvVsY8RVr9nA6Vu25HVQRgJThYpbvyURYMt4+S+2/DXrPhgqUhMob/eokMj7ebEHqe2N7CaGXRxGtdUTRd2WNlNqL6OUM8Yk1vIIsIknPTu/dRJsVRzguzDhgL8YoTvmYeb/d2K0IDhVoyNXgdQ22rg1u4/wBW/8+RuZNuiK4HfD+ydTY4AKKyJ1dsmjwmoAEooa1TuyRY7ndCbEapT6g8sF7O/zY1Is0/Al2VuRDKRwdGQ== 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=X7WAfB1bH6Tqf05Gha7Qo3knwnkvWWywnQB6BF/4AeQ=; b=VN4EA+dvaT4qAjFn66vvWV0SEiQNOODULQ835RljWx5DFVkj9i5k693uTHxJBYwVqlqQtFSPqQoANw7UqcJXd101zlTelViJjeBc9/74KA2dy+UHome/4/Dlasr5s8ed7Rslbt82iPSH+F4PTiGAXSED7Jb3wcUejoqHO4rQFNw= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:27 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:27 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 05/11] btrfs-progs: tune: check for missing device Date: Fri, 7 Jul 2023 23:52:35 +0800 Message-Id: <3b6a812b25429342811a22687245c9732a715a8f.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2P153CA0028.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::9) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: c6dbeaf7-0e12-4c0e-f910-08db7f024dec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TIAgLWvcMrXhU2l0K5a3D0gVzzu7KrcnR/4s9FUGyVg+m2iSeXcqJm8mqDw+0ughp4YGte+ZtBWb5cJwHfhedaALWaokuUuRCsr7U75JzakInRybfUN+nUNJIXb7+KPffsqJs0enA0ozfyt/ReUEeGpdVhs1GqUkit0CbIvGQbHoplr4hyjwl5OUb4AxDjiLniFD4dr5LkQvCR1sBzrWsnAu+UNXFkFjAiZJAoVxYEq+C/CJ+kBL29699tlJzM0pCYkAOxb412f84GKYc5vBEix3WHRXAtnI29X46oWCB624y5MUOhdnVwHatTXh9NEeRcr9nCQA63ik+ArIk0wo+x+LlP8+UMi2JTcXGOHVe28XSm2eFeJdD8Ea67JnooG4NeG4NZwTMQh1ALnoOyzCD82SD+xXsiqhxYaDj4Pa18N9iN+xO3zDezFZfaepC7FG7EYlDe93WML4TVRkCKv/yje3LiR7SFQ/nzWx7c295NmWrYrYeeQkns06e0X5T44y3s4WXNZzfqarcfvImlI286vJI5Di7gu1ZMiLE7ty8TOtjt83my1Rf+G4ZGwwIpox 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(83380400001)(2616005)(2906002)(4744005)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lrXFQUT1kmzmB9/3EzHz5kJs4VBzNk5OxmvdN/9wYlI1jKZ0mIn2pWH515vPaiTYkLkJ29RaSJoQt06oYxUXwUzV3DwttF8ukuWobCZbnEIe4mxpAOOtBJyUKkkTYwOaCrm4MRQIDOF7+wOXdtHnEIvh52HNY5DuIqMR7vg/3Rf9WNL2sD+fdZm67CT9B6lpZxpQBkBm6Q7W5gTYU/pi6KfF6D+j/UQraiMgdXFjb4R1tJg14apNEY/CaTN75OXJWZxoJmsykvZ6gTz0cpiObjpLQ5lclPIJMVsx3dOPMdD5wWkWICLNzMe6zs9tTsoyGVv/lDmYxhKicObqfR10DvKOZX3SoLjDyHmH/VOYhqczeA93CA9BR91DL+zlBBL4lageAiNZgY03OIHRCIOeY2sLTYjSqtyZxTt8E4LCYaiLxIjqLro7+297vmU+TQB1pvmv0CsUfdLBYmVI26r8Wxhl893uStcuFwD12jqV1B5xh2V4NtM7BGsnCX+zXqcMpOHN3CR27JPmmy/xpvqQgEZMLOSqoWtLjwKuc/c18YbQpj5VndpPezy4ZtA16mZOvyMn8oKRmaf0acee4qfqyHIFOezwee3103rIaGLv5/EXVIFFVtEazFdySDWiVCm6JaTmnRReE9eQR8KO5T+dlKgiNeM5ZwphH7PIQhXZmMXXHh9HX4vOSYI9j4dWJMWwsRqBIyf6Y0rlD/DYi+b710XIwkHInmafAsMqPrfRx4xw2bu4aXSz5tFVFbD092cW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wX9AWE51SYUujq6+XeirCiklCOHlo6m/kZi1Mv1/uEMaaIeLq3bCdcPS4MfNp4Aq2QxKIewAS0YZG60dSrJMlJgtAW4XQbUQRM6tG0ZMaVdf9Mv8avHtO5lyuCoZLV6IIGX0HoiKNbPVlh6TVQxh/TeabcqQSbCb2spG4NKAAWjtfvu3as3Pv0f0q3Fi5MVUzH2lTsHGMNzHMCvtJTKIYVlVjD7klVeUsdst6v/FoP2urEsFaZKWKuME+gM/3Vm8HszDTCmZF+QxPAiv/YLJZPekMxIrhCpqt7OEpHU1bhH/jXK4wD69R7p1plZZl7T0NaRvMCeThXltZAmQO35j+AEjmj28ZamqrKttgNFqnB3Y8JvMS8TKuDJimJ9+Gnh6uUq7jQMBsgtpUuVlpfqR1YV1ZBEdDuYOWopdR1kyCIPzLwLtHujosi+1wgHF1Z/oRkNIRN808LdGhEbnV+FPDqQfRSUfo3gdxVzkx5TyvHZo0bvrTOj0+j5sfzzX3uhRRaUQJlI0qyH7XiC6D0CzdcPlH8efTFC7jVnpN5L7hoGV7Y/JswWswvbImTXtJ6nmAQpZsC9QVsEP79f+xc X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6dbeaf7-0e12-4c0e-f910-08db7f024dec X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:27.7998 (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: vcj7nZ9UcA/MjZm9qrwi/3fqJ0D0ei7oKtBEj5Scfod1Tqm4zC2Wa2RoS5NG0iCl3xN1UXRsOK7uKdnU6N5v5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-ORIG-GUID: kiVlbFTw1f28cTLD5HcnZE5TLvxaTnc6 X-Proofpoint-GUID: kiVlbFTw1f28cTLD5HcnZE5TLvxaTnc6 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org If btrfstune is executed on a filesystem that contains a missing device, the command will now fail. It is ok fail when any of the options supported by btrfstune are used. Signed-off-by: Anand Jain --- tune/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tune/main.c b/tune/main.c index 570e3908ef8a..dc72944a2b67 100644 --- a/tune/main.c +++ b/tune/main.c @@ -330,6 +330,13 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto free_out; } + if (root->fs_info->fs_devices->missing) { + error("missing %d device(s), failing the command", + root->fs_info->fs_devices->missing); + ret = 1; + goto free_out; + } + if (to_bg_tree) { if (to_extent_tree) { error("option --convert-to-block-group-tree conflicts with --convert-from-block-group-tree"); From patchwork Fri Jul 7 15:52:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305080 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 EDFE0C0015E for ; Fri, 7 Jul 2023 15:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbjGGPyD (ORCPT ); Fri, 7 Jul 2023 11:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjGGPxp (ORCPT ); Fri, 7 Jul 2023 11:53:45 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ADE611B for ; Fri, 7 Jul 2023 08:53:44 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367FNhgS030779 for ; Fri, 7 Jul 2023 15:53:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OKSSAO2FySNFU888KIJknebyCV49MOUkfd4IgY8UFHA=; b=Owq2fBxYNuVe+PE/gL7yRAV+o/i7Z7nD+nuhw8vhwa+xUWr/RUdKQDpqrexFxOKHCYxx gn3UbhcIr1nYT+KQjJ9O/TDS+vT7GXdfUPCfeP03XuWjjO5yWx2swpc5cXhpNluo6yBK LtP7kBO4HeC7TD3EdkFeCMkVoY+xDxV/9o6bILdKIMNOjsBHRIk1seXygHxPtGrD80tt 86SksBMcMNV4zEppXJ9KamknUKx1WNfdWMlhcZJGPqLjRolfgsHxiNgy3G1Ec6iA6Rk/ hlljEtLw2bz76qD7Rgb0FvPPBlTMkM0UVwbTKch7lqddCS0igWEO36sVnl5Fl0hhfTbD 5w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rjc6cuaws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:44 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 367FZkwN024415 for ; Fri, 7 Jul 2023 15:53:37 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak93ce6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuvQnE8+l+GeK5KYuh3nnHEI9BrhYMNQmCPUrbsU0zAEUgRSz7I+rcri2sFQuONbDqzSUv51I6IuD32aQvEkH03fNBH5hg4eEd+VD1dquN2Yhi9BOGrUbv7h0zHCaT+dDshdhpABSJFxtl8ZC50InNeoM5qEw0FqwzEdPyIRevhkTI1pOyJI+DMm6zcTDJagLFup5nv0L0+yXtR2XtkyIjCc5rjeCEkYEGkqZnQUlPrgfrj4rdyDORHjTaAp9s5mLhGgLmgk3plULdXmeqnF1rKIaroWQCmSl3evlD7JgaSPxXqgczcvbehRiItW/nT4/knyPAOgtiKOLVefarUoWg== 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=OKSSAO2FySNFU888KIJknebyCV49MOUkfd4IgY8UFHA=; b=NTaDbDjZ23WHV1enQFGhsc1zrXCJYK58be3006S0pPYIS+VZ5JajAxiWo0I1s8ePFXT1JK7nWhr6XT7Vnwt8PHnBCSX3CbSrC+b1CQT4ZcSK9DaxK5kdFTDDGDJZqXgEUPl3ndnS4CDM+SRfIWuWaosrJYtpn88VOmj+Il6xKT9NDEAtMU+nxQJJ/byeQJ5UM7Cd3yNrhaCt10bfn4cxZ8XKb7MAtz5aKtRxdEdIe1K0LQMIY8KcCCqkou7QwlzTqJWvLshrEMUQi45IB5iUgNhCxzKLKel/HDSpBCjmp6RmtpWUj0GIuvi0vNLCbf7OjPSPcy+S6bwv41Txh0hk8A== 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=OKSSAO2FySNFU888KIJknebyCV49MOUkfd4IgY8UFHA=; b=jufZq+TuPlb2MzPZXs2gIYVCJNHNAAlfucQpqDZlfD/lJJDJVtFt5l0/uwn/9Mq4DfjD1+8iywGLErqTWgtMKeoajQNQ/Kv6sJRb039h8bLk00dizWNuvjx5aUDdyN7few14LE89CueSM7cz7cY99G7cl41dhVjXBQ8XqFNpMNg= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:35 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:35 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 06/11] btrfs-progs: track changing_fsid flag in fs_devices Date: Fri, 7 Jul 2023 23:52:36 +0800 Message-Id: <8964ffba81e66712b57ac826c139ee0d8c50e75d.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0060.apcprd02.prod.outlook.com (2603:1096:4:1f5::17) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: a4bae61f-444d-4ba1-5211-08db7f02524d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Mtz70RZJsaoVwUpuTC0BiIdwuWdWWiuzHvlpqssq9L2rtPydPc1fGa3hJeXo6airP/w7tCAGwwmsxUUBsCoLC7IlvBpfqh9vmZwoEDFVDH9jWUzXFhRq7FISzWamboqkPJ80hmbcvx0yZNQPG2oSFeLivLFdPHkL4azzaNkf8BNhBnrQ8ISVwvuBZ+2kJLbFAJNeyWUtngGvA5bCgLeN7RJDH/wXR4ieu9kW6DumzLmElM/6PH10rxXzW6dDl0ZDodckONR1XyfJYwQLDEQGI2C7R0Cf2yrbWpWZ3lujTC+vSdL0JC5tIXePBPiQ3dIRCOy0Qw/JGpejLsfDBBE6G5LLG8BIED7A2LDV6hJWZMSuNeXQmeFqKjR1VPgMbHnWzH6m/pt3TWGE9UO8gMGP//Z+3IW/5D540RjpEockbWeKYAjX6Eb4CDeJXPyr7DjGDb02BhgQ+PVglZjK+riPzT8VLoFsrUJ1DfdQUgj7J7oeDfzTvFdFqDr5p7RFRXM9mA3MqJanA4pA09v6946XG7ba3RUneVAB5UDcrqByn6RufVbU438PxKYYDdRa6Hq 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(83380400001)(2616005)(2906002)(6916009)(66476007)(66556008)(66946007)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HSZmjo9j9Yw3EXaYfvHQrwZRuMK0D4HpdjktiYVEhpoZBJrs01NuroUbUX427yq3HXIfxRd3oInsQbpZWD4okmMuFU7jmnp8Wr/uUo261f2SRr+v4ThI5nJRpVW92HOTRZO0OP0ih26f1YyR1Rx+NEgsyGkZb+vztFYs7wU/3luJH49EKV2tyQ8LCu3rpS+DiSWhKegQcHX9eBMuM2ZksbYE7t/DF7lIJYpZJB9m4xVxLYqhOkEHZyXDcU9BShCC3rb1PXU4bqKNGFbSDhuR+jDgwHRHkpCyXG73Gg6KhsiGgetTkfZhaJyOTYdj40yXTFc4ehdFdU5jbJEv10I78hUSeC5tFK5JmWcjR189SPZPA9kTGS/SpxcACJ7A3HZgyY0KvmeZ7DZBXggiysgUHOfVnj4G0LOPwbaeOiggThI7fF8PVQhs7oR6ee9uv0JnH4tta65bXH97XhG/Og54U5N4PGFQlRmVf55XzhD4KrivEEULt+v4r8qfhoZuidUrDC3FlOlxyXiWUzfxECvBJvvm9CVHq30krOeRAcLwEzUwBAXRFBWXMZ3VUcVgqGvYKi5SrImClzqVrhRoRScMmxVtYcYhOA1PClt8NslmBZLKMqsS0ZzKpBZCP5E94W9mudc5sOw9Vyvzqu4WwI7GlqauIfKagKlHwj5Ed0IOPdJ6sY+qDwtAQxJWT9XO8x4YTsV/YjyqxhDJPGHI38ZITD6yVlu4bVKyZa4jes1QvjzeW79B86BHy6K6nbIN1EdSCjA2cdvAWbn3JamzGnZKcr/cFMAGlJhssjSAwRXt6cScLk7uiUIQLQKNTVc6IoEA4Y2krlUM6XNwFA0phZSyx5hw6lZGsIpO43EmPuqs4zR6aduX3WQg8JIjAbABw3QDWKPSxv3CKxMvavRpuAoHHi9oOfcLE641JWKK49kdFgYNv4ONvoprndLmfFl6nMbxSok5ypOML6AYB/Xd35ntpkupoQjLh+p/ASogA5N46BqTXDW60PFAiUcde3sW718WOd8zAq713kYMG1Er5kEldnjftloXqp7IFvyRCvDZFWvB9I0P0VCDB/SPZ0OBYf+7WIAVlsNpdmOCT0SF1xtzhib360iX89PzCTyrttfxBE8bay+qa8WtHi9+TVcmlhfTYW+goHT0g6SWKe1Y471juI+aKrVAAs+7dgTFnSRmXNT5M14hqxrBgZKKYLJyfTAsYVUwWS77I9ynJNw1HMTP1pinFCAJ+8KQcDNo3gVnpDI6TIB0bAIuVMgDTy5d8x7/oAyH10+84hGR4d4VLlZVpMNnJugTCB1HduQsI7a7LCYi7KX7AJiZXGhNtLUAve8549uFUGR1nsZFQe/M9hpYJWvF2KEuVlITbpVERO7xF/wRC1TMLwTELx4/es7f7Tat3oxqPj5tnzNEFt1tMliJBR6r1aevypWrOhJahd7VYLUubEr1XQVyYy4vNFvy1EH3EYOnCaDiQKa9jf35ohXP9JG58RvQNSx21vMepc7Dm7ue/8bNRq0i+yDj5+2UmQLRNJYvh2PtWOGqGm3qdUYA0YWmkjNJwW+7edlK0afcfy4LRIQgIiOYUDQwdNqjg6RP X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1agIvv6R6qpf+d5zEDgtlr11XxlLTIk4OtJVWIpldnZGC7QUUkyK61Ogx53heDRAf6s5lilW3ciewFfvYkZn1dAjwqRmFdNm3HdTX/vwtQShdwjOi7RIEAJNx/6CfP2GjpZGZh+acbmyNGxrimcVMVxb8KGqQHYbOZ7uzOhXlAn4m+O4QQ7BfrypTk7SL1TwyuK335st2w3yLqUtQKIfusKzdsCrtlsxWmoL3wyMpbpDSXya6DLrF3qP2yKDRc4CjF+LPN0fSzzLwa+PmJVMch5Zru8n1jQdJ1trMQwizwCOcZwXvMAYOTxlNHSwECO0ykBdLSxROWLhuENq3RgOkEsNdz1MvH3Pas73PZN3Q1P1cBVXv3LXdu0a3ZX7ikw5KIN4I+4ePoM8Yg0OKUlpf1T9FlaNgPZl7vxilqG2gdJP4rYWVG/luC6y5Ba/ST+Vax0Kzh95a69e1IknPg1eUk5DNAJt/WCO7hiAdzg7Q+988UNfROjMsYk0cVKK+wdyHgJfg/VqvFDdf3v5hjimkJr+Gn3b48kfoTVE5WrHDyU4UXzK6qLfW9XLFiy8etrAWC0yhuussBn5TAEjmaBxr1Aub6mvt+6O0cpwwhRIprUrBLLSFTtAcambQ4W1hij5C5Lir5vJIMVQxvHShLjq6RuOXgCpow5ykpBBN+3mzeDhHDLwwPp6u9lmR/NeUlL4N2cN8am2ELPHtDZcqjd2R8sG8dBgTdV62f4kznw1fVEFXrg30YwnMcWN6Svk3Y+l X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4bae61f-444d-4ba1-5211-08db7f02524d X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:35.3486 (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: rHlPDVSsmimk1QN0qyf9gpgypW97hK7BaSbPvo9RdqbjtCbUk0y6xgibjNeKqwZ3d1F0XeoCEQzwWhxIT1JxDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: 7DijbkYmqjH1viX1xUoB_YbJ2ma0jhJk X-Proofpoint-ORIG-GUID: 7DijbkYmqjH1viX1xUoB_YbJ2ma0jhJk Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org To prepare for reuniting separated devices due to an incomplete fsid change task, consolidate and monitor the per device's changing_fsid flag in the struct btrfs_fs_devices. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 9 +++++++++ kernel-shared/volumes.h | 2 ++ tune/change-uuid.c | 4 +--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 4a8c559d4b20..51b3a16a39af 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -342,6 +342,9 @@ static int device_list_add(const char *path, u64 devid = btrfs_stack_device_id(&disk_super->dev_item); bool metadata_uuid = (btrfs_super_incompat_flags(disk_super) & BTRFS_FEATURE_INCOMPAT_METADATA_UUID); + bool changing_fsid = (btrfs_super_flags(disk_super) & + (BTRFS_SUPER_FLAG_CHANGING_FSID | + BTRFS_SUPER_FLAG_CHANGING_FSID_V2)); if (metadata_uuid) fs_devices = find_fsid(disk_super->fsid, @@ -424,6 +427,12 @@ static int device_list_add(const char *path, device->name = name; } + /* + * If changing_fsid the fs_devices will still hold the status from + * the other devices. + */ + if (changing_fsid) + fs_devices->changing_fsid = true; if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index d2915681e6de..9763c677a7cc 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -99,6 +99,8 @@ struct btrfs_fs_devices { struct btrfs_fs_devices *seed; enum btrfs_chunk_allocation_policy chunk_alloc_policy; + + bool changing_fsid; }; struct btrfs_bio_stripe { diff --git a/tune/change-uuid.c b/tune/change-uuid.c index cbfc8634168b..30cfb145459f 100644 --- a/tune/change-uuid.c +++ b/tune/change-uuid.c @@ -214,10 +214,8 @@ int check_unfinished_fsid_change(struct btrfs_fs_info *fs_info, uuid_t fsid_ret, uuid_t chunk_id_ret) { struct btrfs_root *tree_root = fs_info->tree_root; - u64 flags = btrfs_super_flags(fs_info->super_copy); - if (flags & (BTRFS_SUPER_FLAG_CHANGING_FSID | - BTRFS_SUPER_FLAG_CHANGING_FSID_V2)) { + if (fs_info->fs_devices->changing_fsid) { memcpy(fsid_ret, fs_info->super_copy->fsid, BTRFS_FSID_SIZE); read_extent_buffer(tree_root->node, chunk_id_ret, btrfs_header_chunk_tree_uuid(tree_root->node), From patchwork Fri Jul 7 15:52:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305081 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 499DFEB64DA for ; Fri, 7 Jul 2023 15:54:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232055AbjGGPyE (ORCPT ); Fri, 7 Jul 2023 11:54:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231950AbjGGPxp (ORCPT ); Fri, 7 Jul 2023 11:53:45 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A68DAFB for ; Fri, 7 Jul 2023 08:53:44 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367Fihkq007234 for ; Fri, 7 Jul 2023 15:53:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3p+mc6Yz5kTpTY7hzxdwugDBrdvFSiG/IQrwSw1RIJ8=; b=v+y7Q4ELqaHv/+DOD1GpJ+84IVo6cuKO7NI8JKOp/2aKeTQGcvZM+3u5RZ2NM/CoCeUa IWPixklALYU1wxRAQi3Wg/mh2mU4zPSs/Bl5+OvrcQf0jifLvatiXH4iOzwtdOORs8Xd mQF8erzHDusIZnNLnDX2Pj3uVHilKJFecsT/g8LdZHaLE5arx7vNflonAQ55e1W/G3+W N9arb6d4wTXDKQ19AiszA9EUuB9CHnbTHRAKKu7uZGWrgSDuwScnoxzZeWOmFnhTCkJr uZoBVW6w6iBRfydDM6ESH9Q957YjJmdhWF7KDn16BUUXVuKgThQtxU72Wz+IbNM3qdhN fg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpnm0g0r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:43 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 367FbKr4001679 for ; Fri, 7 Jul 2023 15:53:43 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjakektpw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HWn+/sg3T1UdM4IvIMM2TgZQWfAjqOixMrlAYiBapnxLAiYpv7fGzEUkP07lkLlAy93P4QVbkuo4VOCqP7rjjNV9s9k+ZGoeMUlgi9cQtM4rP1QF8btv/TBJPlKgw/J1VvEhReaJTfHAN58JaSPUXsNul4dM3tFF8F8cQzuA8gbXvQeGTfPHiweAy7TwAr2NZII05h4uWqRoJiMenoa5lMexDIe+aHiGEZuZ4D6bEX005sCknzBdcHklZd1l2lLOpMDlSLpzJKKhILIzZdHRVsVZUjLt80pGxXpowDB1kFVYxMvswTbzzgACHdY5qSY/JhIVcjj+VHm9Hqlx1Pfx8g== 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=3p+mc6Yz5kTpTY7hzxdwugDBrdvFSiG/IQrwSw1RIJ8=; b=kl9iTkDk0kVB1rdz9W7iSV3tb44ZmNct3chCNWd/h4Zjdq3svji1gmIhXYzPwDpUotjYfrK1gQAotXHV9/WX3BrOsVD6MK1LWve30oWIRkNaj+wmRKb6Fm2c318fHuc0txMs3sf8xhfNfeV2doX/SWhIFCqM+pNMiF7jX0AKHUjB+4W47q8g0qVyQb6RUoZcJ8V309ieier9yKsI6floQen0vg0xVaIV4rhpgqboYI7HR6lLQvT5n5PRGzrtL6x5qgAbksDqhexisbt8h6Qk830foIfH0mEVI1ENo/zMWx8gX7R4Xk01QN0QTN8XZ7G2WUFgQ4J9v69RHJ++2D12qA== 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=3p+mc6Yz5kTpTY7hzxdwugDBrdvFSiG/IQrwSw1RIJ8=; b=CW3ClI/pBFlUxfM9x7CGvro3KODVarGH+dnuMGpsf3RHWYBGEH8rIXcDYDIwVMtrcZoZFyNOoNVhjjSSBbHihwaTTAVoBYJulb00Wubx1rSzYZr4EtZAhrcbyxC/QnUMxnaP6BGmchsLEjpC8mRP49Vn1raVvfx1vgwjnDsrvWI= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:41 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:41 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 07/11] btrfs-progs: track num_devices per fs_devices Date: Fri, 7 Jul 2023 23:52:37 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SGBP274CA0013.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::25) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d254280-1da8-43f0-3441-08db7f0255ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3D0lGBhiSfUdTLzryNEPwA8InaJiBxkRmivKaigUJGXrINoWcHGLvCCNLUmioYHspeHVt4wZ3txjM+eB2VxV+xR8gSCfdscuWv4wfcyiYp0zDW0i5HNEaW5nzg3uU9vHRMDth60MtyvVXeWORLP1UP+BirHH0GVc7CxITNgXSIm//jdGunRU9qEwT2a8QWZ3WIULFd7xrmopnORx4KLZ9ZAi+qBS5YXK3P+pPyY7BlSkuU3zohldTIrIe4peCBIYmZk9rUeowcdOOb66ZcCZ8ZM967u/ZqC1DSjCADFByfXpgYySQcHlheP4owlUKz7jaH5qGdRsGAuk4vj4dv3QzJN/Pwsl/8oOhkFSjC/7n2j+oe0EXuF4XKyVQFPsnoHgSOCfClNrA7nJEusMvnOfoDUXvTZ3fNpTnRaM402O+sIbVFS8dj1q9N+ZvNaKbhJf/s5nWS/aPU844NKMA562W7/7ka6UzpnQvPPn+VoL9eGTAk9Jj/BZB9Hn+MHRfakLyX6/x4ozIQI5iVyIFiL0Jyyz6Hu7uy6LxgYtKG2a1gJTj3VZfMIX7Np8hbzD7Ki2 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(2616005)(2906002)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36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X/gzH8yQ2H8B31lQs/q/XRGV/ivMDP98/JEdUPsczinvldSsy0PcO+qzLvTYjwnf5anLkQK8numq7Ctbq80PW5cbHezxyCp+k+3TM8ADInJULEHG/6i2wt1ubFQ0Ia6CCG1knjTo+iuWPDqLkedmC0BV3bfkbn2xK4iakIRPREerrukv/B/+CXEfVqwuvvTVsiS/DA/JKaEYIcWuax0l/7bTon+QAXLcxmBQgIvebqRPVD947r5ZyvNzkVfr/C2/VraQGeneVghnS0tfb1nwggkRz9gZixH2REh98KEO6XqHwnvnUn8p9lX5Wn9TgLaUUMIPBpBLZGQh92l3qcykZdDzxUZ8x7o5pjCzxED6E1MeGWc+eA0L X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d254280-1da8-43f0-3441-08db7f0255ea X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:41.2157 (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: QxvQ/jYFAe3sOXor+SGrhqTb0k9LAZMOmhm8J3+pulpI/lTx2JTbpbZwUji3ImX1YEWzhdoOy2w6LdMVBY5k6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: vtzmeuHGXOa2ZTnJxfCFTU_QgBzS4_Tf X-Proofpoint-ORIG-GUID: vtzmeuHGXOa2ZTnJxfCFTU_QgBzS4_Tf Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Similar to the kernel we need to track the number of devices scanned per fs_devices. A preparation patch to fix incomplete fsid changing. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 1 + kernel-shared/volumes.h | 1 + 2 files changed, 2 insertions(+) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 51b3a16a39af..1e42e4fe105e 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -405,6 +405,7 @@ static int device_list_add(const char *path, btrfs_stack_device_bytes_used(&disk_super->dev_item); list_add(&device->dev_list, &fs_devices->devices); device->fs_devices = fs_devices; + fs_devices->num_devices++; } else if (!device->name || strcmp(device->name, path)) { char *name; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 9763c677a7cc..93e02a901d31 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -90,6 +90,7 @@ struct btrfs_fs_devices { u64 total_rw_bytes; + int num_devices; int missing; int latest_bdev; int lowest_bdev; From patchwork Fri Jul 7 15:52:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305083 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 473B7C001DF for ; Fri, 7 Jul 2023 15:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbjGGPyH (ORCPT ); Fri, 7 Jul 2023 11:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbjGGPyA (ORCPT ); Fri, 7 Jul 2023 11:54:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40619FB for ; Fri, 7 Jul 2023 08:53:59 -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 367FmOcC031721 for ; Fri, 7 Jul 2023 15:53:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=kz4IoOeXacE9VmIFrWWvcm68+1qOZPU51qnULsRHl8g=; b=HRK1vo7N5xtdlH888wrkRpJAjgVQQfASPD3V9/Pe55rm67EJfiXDUs3T3JvRGuqYBT4h tOfy5pgeXcmbcCReSJH/xqScuWbpPpktYyz8lXBQ/Fe3mDbFOyb+iYHcXfJVoqYWdfMR v3zVbw0OJgrFNwQqdSxmSdy3AVf7y7jaquuVF47MP68PNTQ2bKbCTb+T4tBH1borxDSr aUQBniBJrJou0e++TI2X/BB0qKEJeVzu0BxRHlVTzAupBPQI1G8GW5JQK9I5rw1itI4b UjQpGjz4Jz/zcl/0Rgcfcc3h8j1GjRBzlplNGah3hVQnAMcxAvl4huwSkMB+hXtkU31Z 0g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpb4xh71w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53: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 367Fg5jr013485 for ; Fri, 7 Jul 2023 15:53:53 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8mt5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Snr4sCOd0NEbVqRKuH3V46UdTifw/w+z7qmCmYOPdDwoURks5oHLZkcGDeLhFA2MaAMS8DnbrrFT5kwtZ70J4pBjqa0vuBdAvZ+3bAyqTa+szbli4/dXOotay+SzSvzF8ScLjtCCs333WeFdqQTftc52mFpfx8a4K0g9WXW5cw0t1m7rsXZT/aFyqiPpNXIuHW389Ctyl6DaWuCQf/DKYBEaAqF+VL/rhbYHHWW+5Lmf0Jxhm3zBDy8+sBjZ/jBl53/ElaCFkWD40DzLFPM2I/uZN/fkeg0Qp7uM+cvq+5dEv+gg5OSjr75heK/CBOKsJNE+V7OC3GPCBoZr5MnCbg== 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=kz4IoOeXacE9VmIFrWWvcm68+1qOZPU51qnULsRHl8g=; b=CjK1eOIKz6VpDovryc6Ta4bphgfP+yxY3JUVQOsWIwOBcqWFxjmJF56CV91q/wZVBIaObf5wY/oDbKgcLsWMI2HTM6QCLVqBq7E6QBR8/D0fXzw0zOzLXth8iuS7orkXDmgQ6mgoiFmhkQR5AWDbEOk1FUv2112ES2cH2XYBoSCa3+jBNC59/Sdndny5u2yRhcCD31ebzUnyxZLYTn27iHj75dCSVx+9VwqILPnzO0ZVqc0MBCZ7lI/W7U5KZor+40Hud9SQCbq1UiA9qUjGSNMpCecLWNFRAecdHsGny7hV8OgmanePBz+y/FCXFe3gL0Y+vTfOe/RZ3XjcmKH1Dg== 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=kz4IoOeXacE9VmIFrWWvcm68+1qOZPU51qnULsRHl8g=; b=TGiEQRdXxunnAtPv6ztkpQtJV3m0/p5ntMVGfb6Hwle/QKO/zAp52alSf78OclcYLi5nxkUInaHeWvaLaziTIlGVTYglwZHgx9RHXFZbXNttP+OPcM2X8avusiLTlwg3siFv7tRsP/Y0nnhWv30j7TPBRe9cUZdZPTW51OrIj+M= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by DS7PR10MB5999.namprd10.prod.outlook.com (2603:10b6:8:9d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:51 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:47 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 08/11] btrfs-progs: track total_devs in fs devices Date: Fri, 7 Jul 2023 23:52:38 +0800 Message-Id: <25c9f3b987016c897132146360c5aeab0cca9a12.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|DS7PR10MB5999:EE_ X-MS-Office365-Filtering-Correlation-Id: 71e727b0-1afb-4e5a-8d24-08db7f02597d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1F0xVHMbntSAdY4U32DGwv0g1cyUXDw80Qo3V6jDaRU8qcZHKFoslG88MyUw6AiRiTN3gkXireYXs9Fbl5bSOXiMVoHdNBsW5ZwGsMzooJakLkl6ujQ3tE/alfQ/utOKrJ/E3cCDBbYupS8QP5vwUQ2XPWlCgHBcPOHkCSgQyiifFHegrpMQ9JtEpmwVMjggeaVv+OU4Nf6go+znxxvKmm0SQemXfE0vrmkl2esaOM1Jzqir87DciBB/LPofUqR29RPtEvJctG2s4KiOJaZ34VEvhmbNoBX5ic6o+FULWO1zxqSkBfpVwLZmHdG4RUwT01yrC3IiPydtXPIPLEiW/vtBcN45yhaRUmHMxPcc+y6wljLqYbNegVeMYmTeYmsAJvM6HTxE6Jn/0yxDbRe9t6NTxQy5B0/QulGMyyWbh3MxAicIUI9qnbNA0FHDRAZZ9KGsdST6PL8i5xW2S0qZgbLg0XELuMDq6U6GpAyXlqReS2E+h3QyRfbqIDtmU68T8ktQrOeATFKk7rYnwvjOBEmelBjWfq8sRxXTWh2V1zLnwujDtZHhXkVEnieR/S9Y 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)(366004)(376002)(136003)(39860400002)(346002)(396003)(451199021)(38100700002)(86362001)(36756003)(8936002)(8676002)(6512007)(41300700001)(5660300002)(26005)(6506007)(44832011)(186003)(2616005)(2906002)(83380400001)(316002)(66946007)(478600001)(6666004)(66556008)(6916009)(66476007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4irbulSiX0iiZC1mXTpTtmrlKqyEsTaESo+MKxzSraSs3l9O6uwYRbXoIg+GAVhDBRFtu//PCZifVMHbCvAbpfwbNoRdz6JwbcWNhsP9+BT24IoAm1XcAXndrBtxPDWmtLkMQIwyIKnSrbxkm/2lWmlhDCeMYGwjXTun9gBkHhpyfPH3fsHvzNEUOSAS/kpcFyXKgNK4sVKSvTVwsccj6JvgADSmvsrxZ+KqxtUAXVCGL8m5Eny+/SE2RDDKx1kYgSo9mBKSt+w3zRHmAdhdt+5Omq6KEt3u30eutOf7Mj3gtCghD1NcLA0w2Qzy0/IURDYsLKDy1R2rZ4Hq0yC3JZ2k29qlZBmVHJzoJz3IcdV6ApiYXhd2PPV0XVVRFuKhSeGxUU+1nPcj0oNbhHKOsa+IAH51phdtRFp4PKMx+cUxIlQoi3DEEtB2bvydjedZeOul6kaOGgfiuoJftGC5ZtQdVAYgCNY847oq/W0BE69qWD0fMNISc/bvAofwwdLjypGl1BFmnDTL3MAeMVyw85ZbNTZxF/FwrnwS4wSEnjBKGWR2KHoBXTMycKd2x0Unkrk8oGkclNmT2s/RWBBiSNLAzLr6gu8DYkk0TcbLJKuHQB0Xu2du2pBQ9GE0gPczm1uF2eyX6LmFFbT64LPurHUfVM31lVkd16xXt/5mvC5Qw1rj1YhvdSYoz1BnvHUk1TA/dzIJcCPkCRbT6VOnOBVGpeUoAF5UZtqhbuM/J8KVwArnqHTXYLU6GlVca42g7jDoWa23eRNQqrwVJ5EymQ2OYzOT5iDKR06groHXDz0Gvj3R1sdxYBEqmGflHWM+eXY45ZooSv5dRZAV0ifyoX+z+CJoHrLNsW+TTbx3frcwKKDs231qLRqrZkGEyKXqn/F65WVAKAPwZBslSmET9+DNlQLgXOnpWMbkhKRcUOGCVlSXg/za0k6HvMVVJIlIbHJjmLitrSSu1tRSKYqiKR07et7CC5zo5mB5I9/zn2LpYnfj/3/3ec/smfyxCqO0JFlg4dF0ECAznDDc5e59aJNXovTo103CwQu0d9RONqHCCv/mE5m/Y2DObIc1SzWUchTXa0r/B01SuX2c6423qEWTV+7LY/T285jFeJnATs2ZaXshJVtoLO+GG0X/Pl/lvUtNoUzJMJquVuy0fJD+QakxJgnvbmr6ezVRjMqPaC+naMAYIYbaujMcNExk6JAygr6N2TNZuwTZMimUMXc629pmIklJnYPOPJke2yv38WADcU02lIK0K8F8bgup6rQcaSVKjZ1e2D2qp3RQGMMpt/LpL6y5GBusBpHoNqBEcBh+uHuQ9lOzTVw5NDOwzfWCJAUDLM0OL7WlAZQXOH6JpHbZiZKP1VgHe1LSwm2GjGtOE3EOzZiUJN31wkhCOMEhHHCVchSov9xjlg7euLYmY2xOIKMFVrzqTGZg34i7tp/o0Oi8+8a0tdkyJR/smBenDvRLrJaR5pVGNK9b4OcCgXD6zLy83UcWEwAPytpMPndWzWeqochAETtt6xHzFyNwQpUnXNcI/hjVqNvux7zBLLU0or5U5KTsN/tCcC98VUIsrXD6Kn7pwSadfaMaNhCM X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CiAueX0KswNZ82Zq+R3o4iuD7vktfpYgIvp/xnuV+9uXKWhcgO1C+07R/nt8eRi0aDQlvHDLe0Yc8QFPUPC1ag8YUwfWBKinfoFM++Ci1uKoHHdSTaiPaiJD5QFuomaES7t8RJynMazA0cHCI0tesnp2d/wdNJkJipQZydeF+hUzzJDVGCeOj+7uxGPfMRT2M3Y8Y+JqyYyBJBjGiinxye8F0FCbYPWk7vElmLcwKNvJg029tyXMVj2vLTdaXNNDzneTgUF4KglRfFlM1Bumjn/OdK/lHl4oDh7YCn6k3thR+b7GDq9r2KDObXqWdJdfHhgktDe03nYzZrzCA2x4FUU4/buPl8xNVDzgI3ziEJXHhIc2bACFi1GihJ5z342iF6RS2YBetFCJvJylVfj/TeeZkbzG5P2+1n4KoqjFe08TckhJ4yClxXvJWOG//Q27+dtSZGqFLqbI4nK812IOeODUprpThlMmXtKzDFFM4UnCVALMS4p5ehY1tiBlNIki0x2bUR8ruU57wz5J2zEHTm1Bu12tkIISaR3311WKdJMJux5oW0HjJ1xmSigTDaWGtet57f0PwaoS9zrRRfymMSQlHKAQIJ8z9XtyScXOkfCn+m+wWEGtZT7lp8i/yibAyDb/+mEvPRiLngdyaqyS0BqnZzkuUU+OaSXOIGt2XsLZfp+Az6Jkl/Y3dYl7aKY/Em4FxMkAcEBt4lNUHUGLHcV/Zln3BrD1j1gXCDEs9pBwoccrveGsuitnw/eEpCsi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71e727b0-1afb-4e5a-8d24-08db7f02597d X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:47.4024 (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: QiaNQP5bxUc14irR62QeOu1gFGbbY9Ksh5l3m/mzqQjW/DV1T8KnMzQOmxNP3wMzClL0Eo75A2yNS2Md9jfSvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5999 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: HDXevl4_UcItkN_Bik3UtSN0rY2_ferL X-Proofpoint-ORIG-GUID: HDXevl4_UcItkN_Bik3UtSN0rY2_ferL Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Similar to the kernel, introduce the btrfs_fs_devices::total_devs attribute to know the overall count of devices that are expected to be present per filesystem. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 4 +++- kernel-shared/volumes.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index 1e42e4fe105e..fd5890d033c8 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -367,7 +367,8 @@ static int device_list_add(const char *path, BTRFS_FSID_SIZE); fs_devices->latest_devid = devid; - fs_devices->latest_trans = found_transid; + /* Below we would set this to found_transid */ + fs_devices->latest_trans = 0; fs_devices->lowest_devid = (u64)-1; fs_devices->chunk_alloc_policy = BTRFS_CHUNK_ALLOC_REGULAR; device = NULL; @@ -438,6 +439,7 @@ static int device_list_add(const char *path, if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; fs_devices->latest_trans = found_transid; + fs_devices->total_devices = device->total_devs; } if (fs_devices->lowest_devid > devid) { fs_devices->lowest_devid = devid; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 93e02a901d31..09964f96ca37 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -90,6 +90,7 @@ struct btrfs_fs_devices { u64 total_rw_bytes; + int total_devices; int num_devices; int missing; int latest_bdev; From patchwork Fri Jul 7 15:52:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305082 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 72F54EB64D9 for ; Fri, 7 Jul 2023 15:54:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231950AbjGGPyG (ORCPT ); Fri, 7 Jul 2023 11:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232319AbjGGPx7 (ORCPT ); Fri, 7 Jul 2023 11:53:59 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9259211B for ; Fri, 7 Jul 2023 08:53:58 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367FiRZX007117 for ; Fri, 7 Jul 2023 15:53:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=YrOY3sThUYk2M4Ooej5hFugZCdb7LS6AuH3PTDriM3M=; b=RLmnhrcnOq2f/GKhriXc6nW/mIfB4M/Iur2MKF4AZ7VQGbxdi8hR0l1g05l+VeHNHFAM EKInT68DiEYGWfMJ1QH2AVcnrMEksLAbJJyuIfkPMMqxF1B7S4C/IrO9Oc2Mdf4/OUTL cBvvmYknDY1QrZNtc+KgY+7TnUp+y6qg8MkyAiC+Zcg7tRYZUqdoBceKCQzQrzIBCdHC 0I9eqI75FJPclwSTn/v8tD4UBiWtJRE3S4cR1vk6czc4HJckV2kjvPk0pyi6fnUdBg1C 9C9Vu357DmPgLwu2a2wWpHmHWbEudMZc57nIdc7q86uP2B4EzYcYhuH45Gb2AvMN8Jsy gg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpnm0g0rv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:57 +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 367ESReR007181 for ; Fri, 7 Jul 2023 15:53:57 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjakekdaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:53:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fqskk2a+LfIR0iE/55btemH5Nrqvj3ngz2TQWhuGMTqsG1EPsbvT5Xj3Jhw4SDEWG+CFqkgdsqh4viXDRgAj34ELQHdhHrWIY1KHYKyLsuH337MmqLreQVhGTt7LxvewOobMGB82bxCKi/AiHo+MoVKWEQo5cWziJ9753m9/Mq6060VL7ql8rQkZuf9Y66FRaZzv2AAFbrxX2I6CyJ7FHidrfHquyDkfTBZMkVj4AXBCcJMbQLS/O6tDReyiP32OKiCXy0acDHvT8BJF+nrcB/n9gL0jCT//1dr+UtkR4nUcjql+CQ0Wk5omuwhL75s4AJg/tktpC9jEZodRvNSHkA== 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=YrOY3sThUYk2M4Ooej5hFugZCdb7LS6AuH3PTDriM3M=; b=YTye92SNdY9VvQBVMsb7+28hV/oQGIBAQeBOvPKYCGz68nCB1Obg/Zb/3hqigXMBsaoq18CtQeZslaOgzkL22v7BacR3LUEQwQVvZZSR3YV7BrzwKk+Svq29/fXuNAQGHnNLidvUAgoKjlG5Fpb19rJtdgSFOJGxONQRCDOsfeo+U/tNZE8tiG6VsjnDsacsgnKzIr1oQeb51YYGbnzoGJbLChk0mVl59k8pHjPQ/iHaIWP8OedYC0LEXRiztKqkzB9wtyKQ9qyJmMdwn9gstqUSGj0q2Hhp+Pa4UYr2ThmPFAtuqV5ofJPwQnVOxIXzqPMuvbuKhvL0vVKUqh04Qg== 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=YrOY3sThUYk2M4Ooej5hFugZCdb7LS6AuH3PTDriM3M=; b=b8HbL+QexNykzNmSFF7p9We/PKB69pUT7jqggKH0KLFcErAW4PHYvopA3wFiaRMaC2tTG7t4zH4RJDAe2vfVl/b/IepE+qOBKrOQ/GoKnZw7oTBzT9DCCXA5CR1JP9ZjtRJDFeW0aZ3AM9VohRz19hBTx0uiNK39W46SxfO8O1Q= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:53:54 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:53:54 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 09/11] btrfs-progs: track active metadata_uuid per fs_devices Date: Fri, 7 Jul 2023 23:52:39 +0800 Message-Id: <6e1ce53ea4e08063919db1b9074990a559e8d30d.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0041.apcprd01.prod.exchangelabs.com (2603:1096:4:193::15) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: df8cd27b-8e97-4df5-36a4-08db7f025dcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MWsT7Ls6YKDQDl3WRTIkacvHFVO2KyoA1KwL6wgQON4TUZRh007L5U3KWXhojnsH2KUxVcDYrBMzxdHpvA0Bi4Fh3D3IQDRSbfUePY+zVEJXlFDgl6xEX4U48y6yk47FU5UiWYgPFhw6UxhuIYDhg+I4h/2gNESwSn7wuhp5PnvMLWLApEuYy/D9mSgE3IcMiS5+1+ngwhIsaXjOuuuSvll3raORFd64hkJPlT/KPj44SAfFlHw4DlG6rZn3zjH3AXAZrhL+twMF2xVhLjoUxHvJxxlljy14r8SltJEwFLQwlHa+QKEnF+TLW1UCeWyINk2QxtYfbPLXRfWkDCwktSu/WGnt+/zEirDxYmTJo1bz5GJ2RfHGPlTFKM1NU68LqX/nEYj52EHKq0uxBm4cS13WGSjJNc8+TfsGNh4P+EDISwa6XmgLK8dnnwJtpjG0mvsdQ/czv1ER4NfQyaAAYn/If7y8phlMQlMUn0Ashe9rDp4hltK8EPg2FdlwGULdeCRZzO17YMLewbU0K/Ewho5fH/9nL93owELru1hVgdYhS9n8OAPMjrTTIEk0edtb 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(83380400001)(2616005)(2906002)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D09iipMGlXnnG9PCsdvL1kqHO/IrC4eDxKUGMxpO5U6crez7/zMG6W8K+phkeTazDo79VwT64/2kdh2I2joVcnA+1DdZBAv2a62FGxtoj3a3eK84uHC5d22MyJBrDRII7MbYdUOVJaGQIL0Gw6ndmyjYy14tHMJ6nFuwfxJRqoSx8dwUQJB0nql7r1N2xuAm7SJ7i+/TW7DXbpazOROMevYQOT/Buy1qdpm+KpoIW7m+uod8oYA9+k/VASYZ/xwl735nmmSAm1dDrZJbE5fiZr0aS7SdSsvGfXJ8B2Aiq79CI7Bv4ErJqkl4Uop3zidf6kBG0m0SmudWmsCoimbe2mb4TZ1xFXqs1+2947GraponXK29akcBLgiB/HugbSYxJ3IApo2ge1tm9GiS8rgFGe/gs6C5oFjN4oOeY7KTr3hwFOq00XhoImt5NTbpheaHzgiTIdLTUueIEaKFnyOaz8S5xikJ3O9uD1v/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p/JmvFsOFykuEZ65oQ7gKoPDCf9yzVC8OAg2M6knOohgLGo8AHGQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sTYP7BVKfVbLRha/92clLEAinKgK7nPD7NB9B1GtuNBYAc51qnMXKQEIRe328oG9VNzF28FX+swDuEVZHtovHbJf8xSxUBbfzdNDQfvZWfo3lxQu81te4a6cs+CO7rYGtargd7DsGSCNp5a/3xg64AhcCFsX0955AHzNzdUgs6NXIcHR7YbwMJq046pcRbQyt+vAt6IsoR5/hixDGMPqlAGeqyx5F5dAAIGNk3ukxsY5gkt3/KGYWwGE+oyJn2dYYr82K3xFolU8ykkcYOr5KUsHjyyG/oqIQoytE9lbZrsIdZ23jhflkmvP7GtDLNQ4zU1mxHG/T+d9PlutZkDaDhCA1e2t2mMX5FEeRZUuwMlQc9p+YprfIdwNrZG3iL/veBrqvtkW6mPz3A51xDCuS/2fHMGJynhW4whvfqtzJCN1dIqO8thtC5maLlzfC94iK5LcwArbHZSKslu06LiH8WU2Nfgr4zwbOGjKSlUyN/HO6R1bxFnDF8PenoF/Anji95hsg2JLoPgue6YSMq+j6frmuTTpK+3wJfTh4OhNv6xLOn55hHbNpcBzU/RZrq+y3D4h/Mw5O42yJ1TKrLIs4xx4x694RuCKndjqTvr+EoZl5h7luBAViDNFTZEfXgQmpFvlBKCRwRfVsw4uJDRJl9fNDjpeQBD1V3Fes1+/UKWoVKZCucZcG2Tg9MEYLGW66MjR2WUn/GxiItLrxVtbl1R/3tKWMn/Mz0wL3xvOHwrmNvmD4vB1kaLpfvXwgiEl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: df8cd27b-8e97-4df5-36a4-08db7f025dcd X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:53:54.6183 (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: UyN1INXogYN2x0NcK+F5Z4EjD1ysY2p+45dwHJMV2Ke7Hn0kR0cFKrt8MaKB/vOGmXhmBNHzuz6B+kjcVG78QA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: z_U5zXuD0AfIOsZx30FJurvbvuHUa9tv X-Proofpoint-ORIG-GUID: z_U5zXuD0AfIOsZx30FJurvbvuHUa9tv Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org When the fsid does not match the metadata_uuid, the METADATA_UUID flag is set in the superblock. Changing the fsid using the btrfstune -U|-u option is not possible on a filesystem with the METADATA_UUID flag set. But we are checking the METADATA_UUID only from the super_copy, and not from the other scanned device. To fix this bug, track the metadata_uuid at the fs_devices level instead of checking it only on the specified device in the argument, and use it. Signed-off-by: Anand Jain --- kernel-shared/volumes.c | 2 ++ kernel-shared/volumes.h | 1 + tune/main.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index fd5890d033c8..ac9e711a994f 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -435,6 +435,8 @@ static int device_list_add(const char *path, */ if (changing_fsid) fs_devices->changing_fsid = true; + if (metadata_uuid) + fs_devices->active_metadata_uuid = true; if (found_transid > fs_devices->latest_trans) { fs_devices->latest_devid = devid; diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 09964f96ca37..13d08cc7eea5 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -103,6 +103,7 @@ struct btrfs_fs_devices { enum btrfs_chunk_allocation_policy chunk_alloc_policy; bool changing_fsid; + bool active_metadata_uuid; }; struct btrfs_bio_stripe { diff --git a/tune/main.c b/tune/main.c index dc72944a2b67..3ca9c5716573 100644 --- a/tune/main.c +++ b/tune/main.c @@ -444,7 +444,8 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) } if (random_fsid || (new_fsid_str && !change_metadata_uuid)) { - if (btrfs_fs_incompat(root->fs_info, METADATA_UUID)) { + if (btrfs_fs_incompat(root->fs_info, METADATA_UUID) || + root->fs_info->fs_devices->active_metadata_uuid) { error( "Cannot rewrite fsid while METADATA_UUID flag is active. \n" "Ensure fsid and metadata_uuid match before retrying."); From patchwork Fri Jul 7 15:52:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305084 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 1F4FFEB64D9 for ; Fri, 7 Jul 2023 15:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbjGGPyI (ORCPT ); Fri, 7 Jul 2023 11:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbjGGPyG (ORCPT ); Fri, 7 Jul 2023 11:54:06 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 982AEFB for ; Fri, 7 Jul 2023 08:54:05 -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 367FmOxN031722 for ; Fri, 7 Jul 2023 15:54:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=HJIjOH4vuS045OLeLpWkdThOKe84CYoagufVT81yXR4=; b=zUvO0TLcryqWzaqkwnCXaksFP7YOJho+Zf/FfwvsvftUPzXTpX0xHYZ7igKmR+W226YX +SzWdJCA+b/bXr/hT6FsZkaVAbrQDVLTnz44QPfuFd3b3zFl5VLC7E/7xtiYn2YQpRWS hUv4M9uM12dGIVheML/CZFrUp6dGcI1D70RMpdRzvLei5yYqqEshN22MsTK1EB8dxHsg WyJANKAO7ourKoXkt/hdks4cBbpXZW1etrLcl+hBBqEqt1qUmhquVnxtDbxPuN9cs4A4 EaHfgOAfdcFf0wAUVYYMH4/J+x4EKEGovowP4z2CAQ2BUXCghd7JmZXf1XFee37LXvnv cQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpb4xh72e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:54:04 +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 367FKN5G007264 for ; Fri, 7 Jul 2023 15:54:04 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjakekdec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:54:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y9WXuc60T4B4xzORlHfMv3FnbtdCl5uyVd45WJKqI55F741UslB4f524l+C/Ra1GiIk1kqZNVVTavU4pLiiV4iVlfMTil28By5TSU6m65u9Dyac3S32pzTMrZqgWQVN4KJW3GE7Crl2Z3rmGI9zEmVCTuqx1l9dO0lE6+KYLPerUk8LGa1djYsox2EJ8c9eWYOYqyeZvy2+tjYaPiNg2myPqw46vgNivWcSeZNXsehS1sZNfL37nHMmIfdYNwZor08pY0nLMR3+2aUi9dTRyFOiCijwBDRCJKAF2O5v/UjUugQ6CSIrYMZY8wI8W4Pav7vBO5Q97YHPtQiqnzSoL1Q== 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=HJIjOH4vuS045OLeLpWkdThOKe84CYoagufVT81yXR4=; b=n8OQojVXJszLeeSorrL44x/3mugX3vPUc5Lj4UdgZiIyRC/xbmFti8ZYMhlDtWxDLTTAUCMvZY/pWvsYVckci4t5ew516+cpQ9QRLm/E75VIrd8vXfbIULOHHcR7BDPsYhewQSH9DkmT0iU5oZTMV+JCMFycQckGmAA1e0zmZfKnEVj3g8kJmqS3uqvEAjqOajQbuDMMa/ePRtzVr4Myxy/+YgdBBjwR9r78NQglANzfF/0YxHmrR09h08+DDyixBKCZSbr0pWy6B5P0lGV/52wUb+tiNil46xoib7ohgp1IGUBcTZIl0ql2HdgTJVvNaChsUpH3h0BbzdAC9uTqbw== 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=HJIjOH4vuS045OLeLpWkdThOKe84CYoagufVT81yXR4=; b=YcjFeidmUYtjmh+6znASO3n4VVMR71AfxzjbiRo25rY4ITJ0Fpkutwt+4OGy6RECfap+H1Rin6d0AVLwLba64GWtJCqQr2WuzPksOcnVN6L44FewEypHSNhLP/pfPsvjR2vZnXa3NlsyGb2GtBfAQIFjLBzSuqswJhL5ESSTskI= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:54:01 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:54:01 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 10/11] btrfs-progs: add helper to reunite devices with same metadata_uuid Date: Fri, 7 Jul 2023 23:52:40 +0800 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0006.apcprd04.prod.outlook.com (2603:1096:4:197::13) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: ce287f82-588e-457e-aa7a-08db7f0261e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wPk1FLscp+qoatw0RkxjdhAIZoggyL4tHtfAN7+6k4RMmAgpQ9MXl4oEGNyn0cx6J/470mNKhB8E1yqD9lNEJnMea4P2RgUKlHeULN1JcCeNn0+6GBB72rrNHCKgkGgdOez7Y6cYtR7h1iRi9so00KfKg/4+l/5a8YEv6fAIKpSTbDZ30OuVkKlxebLGVLPMx3ZO2VpTkccERFTqK7Sw1jPX0tBNjlhQV5D8PyrcYxxL1cSPuzVXBCGgK9gltzL/5yiHrV9v6UGuf2tm9Xv2UYkqaz6TxfiODTCAeEkgYVdQUonLFK1+q39UWmwn8e52Ycd+4Z6Z7Jkq/vIjYJF8iFRerlQWG+2mtPF3Avpwbdl+hv4AVhdvrNNSHsx5FcDv3uWAAIldilfyL/NSKsxtMOEnCd07bzZ2Xn5uRYvYXmFUshGsHVDmcCe09KIXQQjYjlKEuS2vq+C4XqaftGk8pjCueVOt2YIaRrnkwijziinTJ1menE8xgB0YCaX6XmfP9mA9wq6SKTM+dHDMxvxG29qBiWz67Dw4KIL6w5ESgTXfoV+G3fQjpPxeUYBdfqQm 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(83380400001)(2616005)(2906002)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;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5uIdEb/Qy5ULZlc73IdoMMB6SUIbQVQxD8UZUes0jriiO4CfnsD16PeRmHPKamrfgQxFVKc5/T5wHCKcat0JmCzhbXhrYrL5q/bL9pX9XvSoimxF40OSEhuAdwtmW/eUTc8xyZfyJfNDZFPtmVyMW1xOt1WpGQAvjA25+9IHqEKrUH6IhL6Ya/GQpo/+dMJTEYQQB03LPyeLnMKwDkIFDTaqvoOUu+/0ZElqCnidzzVc/aO4rRa7wipot8l1c8e58ioX00MSH+9StjqbV7T92QO3xiziFYET692S3a38YKF2/r/n44buDvJTqKfufKzkVbzcXXTMXW7pRiE8/FLWFyogJs7w1aeEsns3Z2PptWHQyMMilIp5AyEwyhDKRo X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce287f82-588e-457e-aa7a-08db7f0261e3 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:54:01.4601 (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: rHX1vNqO2lX7YZ2Io2mf8ifE1jpWpWeeZI5hldtN63NfjW16bJQ0rCBqo7PqIMQ8dS6IQY53YI6xFXYNebTu6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: exu_iEcT7vH57yjGhx3exNCyC-D45YSt X-Proofpoint-ORIG-GUID: exu_iEcT7vH57yjGhx3exNCyC-D45YSt Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The btrfstune -m|M option allows the user to change the fsid of the filesystem. However, in a multi-device filesystem, if the fsid is not successfully changed simultaneously on all devices, problems may arise. In such cases, the user cannot use btrfstune again to resolve the incomplete fsid change. This patch provides helper function to find other devices having the the same metadata_uuid and have them reunited with the given scanned device so that btrfstune can fix the fsid. Signed-off-by: Anand Jain --- common/device-scan.c | 42 ++++++++++++++++++++++++ common/device-scan.h | 1 + kernel-shared/volumes.c | 73 +++++++++++++++++++++++++++++++++++++++++ kernel-shared/volumes.h | 2 ++ 4 files changed, 118 insertions(+) diff --git a/common/device-scan.c b/common/device-scan.c index 00ce15244a09..512754c01adb 100644 --- a/common/device-scan.c +++ b/common/device-scan.c @@ -541,6 +541,48 @@ int btrfs_scan_argv_devices(int dev_optind, int dev_argc, char **dev_argv) return 0; } +int scan_reunite_fs_devices(char *path) +{ + int ret; + int fd; + u64 total_devs; + struct btrfs_fs_devices *fs_devices; + + ret = check_arg_type(path); + if (ret != BTRFS_ARG_BLKDEV && ret != BTRFS_ARG_REG) { + if (ret < 0) { + errno = -ret; + error("invalid argument %s: %m", path); + } else { + error("not a block device or regular file: %s", path); + } + } + + fd = open(path, O_RDONLY); + if (fd < 0) { + error("cannot open %s: %m", path); + return -errno; + } + ret = btrfs_scan_one_device(fd, path, &fs_devices, &total_devs, + BTRFS_SUPER_INFO_OFFSET, SBREAD_DEFAULT); + close(fd); + if (ret < 0) { + errno = -ret; + error("device scan of %s failed: %m", path); + return ret; + } + + ret = 0; + /* Check for missing device */ + if (fs_devices->num_devices != total_devs) + ret = reunite_fs_devices(fs_devices); + + if (!ret) + fs_devices->sanitized = true; + + return ret; +} + bool array_append(char **dest, char *src, int *cnt) { char *this_tok = strtok(src, ","); diff --git a/common/device-scan.h b/common/device-scan.h index 7a6874298051..a1193e7f7020 100644 --- a/common/device-scan.h +++ b/common/device-scan.h @@ -61,5 +61,6 @@ void free_seen_fsid(struct seen_fsid *seen_fsid_hash[]); int test_uuid_unique(const char *uuid_str); bool array_append(char **dest, char *src, int *cnt); void free_array(char **prt, int cnt); +int scan_reunite_fs_devices(char *path); #endif diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c index ac9e711a994f..642f7084cf63 100644 --- a/kernel-shared/volumes.c +++ b/kernel-shared/volumes.c @@ -2958,3 +2958,76 @@ int btrfs_fix_device_and_super_size(struct btrfs_fs_info *fs_info) } return ret; } + +static int find_unifiable(struct btrfs_fs_devices *fsinfo_fs_devices, + struct btrfs_fs_devices **ret_fs_devices) +{ + u8 *orig_uuid = fsinfo_fs_devices->metadata_uuid; + u8 *orig_fsid = fsinfo_fs_devices->fsid; + struct btrfs_fs_devices *fs_devices = NULL; + int ret = 0; + + list_for_each_entry(fs_devices, &fs_uuids, list) { + /* skip the same fs_info fsid */ + if (!memcmp(fs_devices->fsid, orig_fsid, BTRFS_FSID_SIZE)) + continue; + + /* skip the metadata_uuid which isn't fs_info metadata_uuid */ + if (memcmp(fs_devices->metadata_uuid, orig_uuid, BTRFS_FSID_SIZE)) + continue; + + ret++; + *ret_fs_devices = fs_devices; + } + + return ret; +} + +int reunite_fs_devices(struct btrfs_fs_devices *fs_devices) +{ + struct btrfs_fs_devices *other_fs_devices = NULL; + struct btrfs_device *tmp_device; + struct btrfs_device *device; + int other_fsid_cnt = 0; + int missing_devs; + + missing_devs = fs_devices->total_devices - fs_devices->num_devices; + other_fsid_cnt = find_unifiable(fs_devices, &other_fs_devices); + + if (other_fsid_cnt == 0) { + error("No missing device(s) found"); + return -EINVAL; + } else if (other_fsid_cnt > 1) { + error("Found more than one fsid with the same metadata_uuid"); + error("Try use --device and --noscan options"); + return -EINVAL; + } + + /* Missing count in the fs_info should match with the scanned devices */ + if (missing_devs != other_fs_devices->num_devices) { + error("Missing device(s) found %d expected %d", + other_fs_devices->num_devices, missing_devs); + return -EINVAL; + } + + list_for_each_entry_safe(device, tmp_device, &other_fs_devices->devices, + dev_list) { + /* We have found the missing device, bring it in */ + list_move(&device->dev_list, &fs_devices->devices); + fs_devices->num_devices++; + missing_devs--; + } + + if (!list_empty(&other_fs_devices->devices) || missing_devs != 0 || + fs_devices->total_devices != fs_devices->num_devices) { + error("Found more or fewer missing devices"); + return -EINVAL; + } + + if (other_fs_devices->changing_fsid) + fs_devices->changing_fsid = true; + if (other_fs_devices->active_metadata_uuid) + fs_devices->active_metadata_uuid = true; + + return 0; +} diff --git a/kernel-shared/volumes.h b/kernel-shared/volumes.h index 13d08cc7eea5..9f755dfa9015 100644 --- a/kernel-shared/volumes.h +++ b/kernel-shared/volumes.h @@ -104,6 +104,7 @@ struct btrfs_fs_devices { bool changing_fsid; bool active_metadata_uuid; + bool sanitized; }; struct btrfs_bio_stripe { @@ -318,5 +319,6 @@ int btrfs_bg_type_to_nparity(u64 flags); int btrfs_bg_type_to_sub_stripes(u64 flags); u64 btrfs_bg_flags_for_device_num(int number); bool btrfs_bg_type_is_stripey(u64 flags); +int reunite_fs_devices(struct btrfs_fs_devices *fs_devices); #endif From patchwork Fri Jul 7 15:52:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13305085 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 A05FCC001DE for ; Fri, 7 Jul 2023 15:54:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbjGGPye (ORCPT ); Fri, 7 Jul 2023 11:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232391AbjGGPyM (ORCPT ); Fri, 7 Jul 2023 11:54:12 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53071BF4 for ; Fri, 7 Jul 2023 08:54:11 -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 367FmRQZ032027 for ; Fri, 7 Jul 2023 15:54:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=na+cArjD9VuESPBUAnkvnGmVnnuhhVZyZCBwJMoHG2M=; b=iKN3t80pmNSdd0Ei1BgvedjWVnKMHTczPp7uaaXHb+3Y2O7K05YBABJCJBlc5aPRSuoD I8Jy2Mje+8Ry+ZtINk0S8czhkounwH+bxPCvYcg4Jjg9+i8pZulkQZh52gHCtT544+bm 34PeHa/ag+IDkgvvzwG1syZ8klz+8MuD5JkdE74PfxPbJ7dlCTfoBGbwgKu7OiZGecC6 wFSYtI6lweRSUXc5ot2z1NyRJz4yQmUxj2LyexR8kWpRzE5chpqggqCINLILIC8AQUzv k2/lkfhusdXFbbX+D9+jcbVvS4SRbU9bfn/ysO/Dc0NYGyWa6nbOGTBgO0wYriS3njav 2g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpb4xh72u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:54:11 +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 367FadZa013466 for ; Fri, 7 Jul 2023 15:54:10 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2109.outbound.protection.outlook.com [104.47.55.109]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rjak8mtf5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 07 Jul 2023 15:54:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bR5slazWa49WH9zEn82QjteSk4IBTo8hPU2Xvcze+Rf9DRjbDoPXTlw8XiFfczwDiXnUec9WRggnym7YNWG+oNegER1df7+7jtxrxTZyju6R/cKgHIXHdnFDXEVygTdcAIXTanFBUYVXCAgbBoBMXxBqZD8kv5s+/puZA8ow8AlEDmZr1ykCQmujhT1wNa89nIVn5jK1t6pqVr6pav+2cXKx7y3FFV/zSvYfqFoVk8mdqZlGE00QiHv7qec1I42b+Pip6d6mTbiDRSzocdlpk8BnI5bMUY/72kM6nu1MxJ1iozjd98/X+uNIH45xg8OWbfkrrE9N7/IYfIwQxv+9Xg== 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=na+cArjD9VuESPBUAnkvnGmVnnuhhVZyZCBwJMoHG2M=; b=D4uaczDWum74FgIdP8HCyex0jw7mYDj+ZVZ/2auxiz4u6C3wuZT8hsp1GnYMDOvgACA2VyugdUUZ0nITi5vnya38gIenUecF8ovd8nsjhO8nyOrhNoFK8jzLabN4jWtCI4BuGmGpuzCbj9oeZZiA+N++ChGJW3dO6n6f2Nt49dUnV5mIqLq7Brym79aKrKKhv+NoWe/WUfvWDLu1k9RQ8TMr7tuN9D7HisyjpShJQGxZgCC+JzP2q/3QdR3UM0YwgGMV+gVLnlxiCvvjjdGPqS4zeNxs6RHouG4a0L2z5VPb0FWS4PaDXI39nAQH7yahg7SbF6EuA0mgWpc2qE7xtQ== 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=na+cArjD9VuESPBUAnkvnGmVnnuhhVZyZCBwJMoHG2M=; b=dslvCoHk/QzGky765PzHAC7p89ox39O+W87Y8lGu5Y8tJTROr+vX+ursYq3gjcM/dpxGil/FP2juVfKOUwAsg4QwtbxNqiH4jx+/+GVI7Xu/U66R8hMmrVx1faJuFghISOS9SN7EClXwRUFyIrhD7aOjGJgQRdphnvDIYK0bDSo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by SA1PR10MB7700.namprd10.prod.outlook.com (2603:10b6:806:38f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 15:54:08 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::a42d:1dc1:64e1:f814%4]) with mapi id 15.20.6565.016; Fri, 7 Jul 2023 15:54:07 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH 11/11] btrfs-progs: tune: fix incomplete fsid_change Date: Fri, 7 Jul 2023 23:52:41 +0800 Message-Id: <24bef15af8c65da69ab8a3b574e0da7b71295008.1688724045.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2P153CA0013.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::12) To PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5706:EE_|SA1PR10MB7700:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d2a8b3a-d5a0-41e1-6bc0-08db7f02653b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /uJLPargDbNvi+Jf9EDVyebXgWDu7e6Dp9KvvPH57yJrSz3d5oLwuZjLf7E7zPHPXhOWgmKCz6qgNOKaXSBmRWi22VbFag+hqSOwbpEI/v1LHyQTAHe6h/OilsRhggkt44zTv0fVTHI3xHUz7zwI7J26NhrYUpx1EdB0NcI0Q/KMAxmtzrYmdCvG1iQsecO+CIEF8gKnOuUonHij2K+osMhDValEswu7eAmhFK3XGwSW3EUcyQ1wSopxGCR/U28nU4gKRWvrl+O2pBXTcCzDOp+jHwpUADggey8LShpUOMkvc7OQWOqXjz22r1GnISIAxTpnG55VXZe5Ud3uG8PtnwiyhdsUTcF2Kc+gUY9P4BZfKt3a07pjKfpBQ8cctwFEpfhxvdPMMdfIeik+C3J799Uv0PG8dc/4YeT3AKJlyxtjoVSRx5FOPYbWut7y7wYOiUByD1kHRHUMCUjszySGgHdatcV3s/pYiIdeVR7ndVxCheF6ISx2N08mk6Klk5lgIKt08coFfs25cL0WYVB22eXhDcyN3fib0sNjhmA07Nn+F4/XLeKPGuTMiH81eh5U 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(8936002)(83380400001)(2616005)(2906002)(6916009)(66476007)(66556008)(66946007)(6666004)(6486002)(478600001)(8676002)(5660300002)(26005)(6512007)(186003)(44832011)(6506007)(41300700001)(38100700002)(36756003)(86362001)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nAeMQ7Rc+JiCrEZlhm19qXd5lMXxIr5iqSAjEAS116MKZ1fg57BLwBfapAZ01zvORHMU6Pkt3AbKUDHD0bMSPHrYcEsEBpB6itsfEIuCxt08JAXbCcaoBk1JUrUWTEhhAVVk/jRaLQw3j2X9IPZzWIiLTP3i/dhBdNUQ4s1OZiwCAEickVRebBRN69Nf+Fk98A06bK694kF1k85CvW0EgZqX9v0RG0vMryQ0aamO3UAa2VbUJWFGOr/2LPBxI2xYkpFTAJ0Wxxev1QSXFEVUKRUJk5810ZcUwThntkctmixd5+d05RK7wROpm4sRTlDc+oUV8jRtl1k536znPAM48cFAZ1S0hfI76JyMwlTUdudvLZtKz98gdMh8+qiwE5V167alE0WnHQDpqNBXDYqxeeO84wxe3iyWINLHDjtoxkQB7WIk1J8HZecocOCP2sN+2NVx21WXOjsXXeq3mzVmV9XIoHvElinurYgyR4wVIXX+b46llECX3wGlHhkvS9y1/3nLXnoJk50Uig21ZxmJfTtAZoDKkjlyRturawwNYZ63RCNtZgJCFCD5bjBLWYT62RNy7r+eGB4450YkCcaFzl2KdWRc9LTccW+WJeAoxNI26ffqNma6VBIGJPtpsYKC/070ruLAco0KExg7vYl8KykCCJDgO4QJgFbK/B3KdXZtpW8Ksd5bVKTwGnshxcA2Ibm3NdiqDruV8HhRWbImW2k9C/pEtYVolr/ARAHy+0Q0LyohX3jvvn9JTkJM5VZas6MdPqmNKCOv78GDFabgHaDAQsdlonb8Sj+oEU8+fJxYVgD9/Kl4J8y1tmCJzCP02FTg0K6hwVD5b5v+TSC6pipFewRsTigTqI6pIdKZ22+wZIBxk405tPl13W0uij5r1e2GIV1pFX5smKhHbueDQ/BhvKO2V4TpYowIh6rtfcalYouxZyCOkklT5dXKYj7NY8vVjsDFzCF8ZHfNNw/LcLDsbe+TCIdthz6jm7llpF2Qw+/iv55T/B2msCU+AEOeAKusKFquMoAhP9n5ryms/Z3lB6ITwKWSBVbc1awttcnADbGykb1mJZtjJJlhNYz1CG53LzT6exNfsnHfK7cpUYlpqjTYt/lVRvWZ6DTrRdLhKuewj1vnHLLCHyoCY7fnrqs+Zh15ITjmtOxUlevWWbf3JLnLOG7/F46ehvY2WFBhhfcKyON4BkjCl21aiBD3O9VFkspm8HWYEHzxZncDJOxFl7do4Lu1pBFe0su/NzQxTq7qeS8vv3+SG8vF/5UYQe89/TGzXWXMj9ZqQM2HH1EOg8z0dd7Het9CBJXEbW4zpKm9qmMsyCWE6lTaYkuGKXOn9HpjScWlCdXjFdcBklDQmZ4mM2EF5ID3Dx1tpxbx63NlOjjQSnUJgDX4RvQiR0zk5uaJ8P7+NLo2XLvqqMdVqYrzX1s5Nor5MP3h0JbhKYu/UvHuSi3KZc9zIQlVNOnO7ugXQgGQFUUY+haJMew09AgUUXgCTuMRPt8f6xLGSkholwjgnNyjNk++WYENC7P/2q9ZYbC4JENP61emoYuleBTSQaimT96kPFUKXIV8kzgwiF52vWoqdLRhz7hBQsnvHX8MJmETcNQZeVDu2g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2CctbPiyi575f7YdineNpN1isF1kOSVIb6EqowXO8NprGlhZSuMt4XLPhd8qmVuuuJ2lCUj65gjYrXfSSbXVgQmKpPp239VjEc2qdIyhu/KyF2ZvkB+HVi5wx4B5jRwR8MegaquSUoGouoo6AAzAeWg2l+MqZo6TxMHaOaquJ56zbHnp2aygWQhQCLznQ49GtPcCs0rC6nnnk5ziwcApgI/uPCCydMhP5EcfNz6+skztAgDJEj0OkZYULecbLojHUrRfCSTDNI3JcEtUCTqvCO7cxoBghDnArfpRv7NtfgtDFQpf75yuTJ/pzNaP5W+zLjig5EJAztlPvgcUr4KORHz7SM5dLltee9Vxz6u26L3naKpxoykk+mH0PHaXCP5dmo2JpC6FTooJJ4mHakyBLfaCkGEEPCCzIyEGFBX5km+V3PfcB/bCQVzac5ddVdTGjexRFx+gERWeSVGatXycecEnMTYI+8HBRFLRSdZOsAIbq737g81gc3ksICcQVQuE041Pa5loKyyzBF2OpbEf/G8BjgQUdm6B3BwXPrAdWYrIW5RBtQdWYRFKrrVUelaJGsd3/14Hg4IMYD9egKTAZXO6rmvzO7omtTl0PWiY9Ckc+rDCz1sUF7mnW9EynTyP2W7/R/pG/mWX02zv/qSW3USHx8v+T3TGge4MUQMUQFV9xEZhUBFZwqgYD195asIwK4XRRQamyHU6h4sIXpFBPB/iEoce9IEYSdlsJtdzPiyjWmfvgzMJfcot0fojFKwH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d2a8b3a-d5a0-41e1-6bc0-08db7f02653b X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 15:54:07.0722 (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: NKua3YQgKXAzEMLp0gySWUT/mfYuvnrYsRBBf2drxsFXeLtmEleazbYQn2UtEVFHCKsMYGsin12c1HYxccWiwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB7700 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-07_10,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070147 X-Proofpoint-GUID: NM17ys2DHoYEa13vKCUFB-6hnx8hS418 X-Proofpoint-ORIG-GUID: NM17ys2DHoYEa13vKCUFB-6hnx8hS418 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org An incomplete fsid state occurs when devices have two or more fsids associated with the same metadata_uuid. As it can be confusing to determine which devices should be assembled together, the fix only works when both the --noscan and --device options are used. This means the user will have to manually select and assemble the devices with the same metadata_uuids. With this fix, the fsid can continue to be changed in the user-spce using either a new fsid or a user-provided fsid. Signed-off-by: Anand Jain --- tune/change-metadata-uuid.c | 4 +++- tune/main.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tune/change-metadata-uuid.c b/tune/change-metadata-uuid.c index 295308f299aa..c291324ca4c4 100644 --- a/tune/change-metadata-uuid.c +++ b/tune/change-metadata-uuid.c @@ -21,6 +21,7 @@ #include "kernel-shared/uapi/btrfs.h" #include "kernel-shared/ctree.h" #include "kernel-shared/transaction.h" +#include "kernel-shared/volumes.h" #include "common/messages.h" #include "tune/tune.h" @@ -45,7 +46,8 @@ int set_metadata_uuid(struct btrfs_root *root, const char *uuid_string) return 1; } - if (check_unfinished_fsid_change(root->fs_info, unused1, unused2)) { + if (!root->fs_info->fs_devices->sanitized && + check_unfinished_fsid_change(root->fs_info, unused1, unused2)) { error("UUID rewrite in progress, cannot change metadata_uuid"); return 1; } diff --git a/tune/main.c b/tune/main.c index 3ca9c5716573..f6d56af80dbf 100644 --- a/tune/main.c +++ b/tune/main.c @@ -323,6 +323,12 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[]) goto free_out; } + if (argv_devices != NULL && noscan) { + ret = scan_reunite_fs_devices(device); + if (ret) + goto free_out; + } + root = open_ctree_fd(fd, device, 0, ctree_flags); if (!root) { error("open ctree failed");