From patchwork Tue Apr 4 14:55:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13200410 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 CF7CAC77B6C for ; Tue, 4 Apr 2023 14:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232888AbjDDOzs (ORCPT ); Tue, 4 Apr 2023 10:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231661AbjDDOzr (ORCPT ); Tue, 4 Apr 2023 10:55:47 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 194CE4487 for ; Tue, 4 Apr 2023 07:55:36 -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 334Dx9CZ004348 for ; Tue, 4 Apr 2023 14:55:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=8/r3c2eEDHDTfs/lB1uV4D0ff86+H6mlR9e8ju4Bm/o=; b=ekgfTI0yBGoAtKH+esqHt9ZhgeQtSkUrdQqvHgb8f5PX69yj0Flq8xcUPgX40YbdHyJt dLs7S6tac1Whb1w9zZWS3bDQRanDeIMFDN6Y9xwkMYjygHO0oTeMym0tDB8YnTUWveih UzuUe3PGir7crDQyEsQdJSIJz1N4LYoGwzAMBuEL02ZsG8Ef6c90F5A/yF2Cgf5t8e+Y UEenvtpblIqTbNPIhE6RWH1zpVDKh3sRv8A64rTujsnUA8E14jIsuepGVlMCo5Fd3L54 +4HgVtPRa8sOgIle/qQBhkO73H4nj3/rhdwsmJwUV1qywG0NaCZvgCP4i/pivUzZJoWu cw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppcncx1ck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 04 Apr 2023 14:55:36 +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 334DoObM013415 for ; Tue, 4 Apr 2023 14:55:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ppt3fymjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 04 Apr 2023 14:55:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0cxwFyDaSAMOZdsH0XQMpmUXVFZj2OfqAskNlx6DDWnXXA2Otsi1Uww7NWpegdsc+R+DLGF7+FKhLhNkpa+rRhofPitbnEN6INSnU4hvfIakRCcH/NKgSLbDNZNcco2v/lXPbAwwYB4E29zc0rN1Kg4Pda9AGPONv61NN7qqtV3VIG0e6Fggu89doZswa/I8jv+oTflAVLQKSp5VdbEa6NWl1KVhFovZj3z4IeA5upuKnWHSeOomWWXFzhzX1Hw3HBYHFdlFmEQnmQ454J743kS3f6lTz4ZKIkqNnYenGF5XOw2W4RX31yuoJLUZGSccMAEw5wPpx9hG0INRSaKiA== 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=8/r3c2eEDHDTfs/lB1uV4D0ff86+H6mlR9e8ju4Bm/o=; b=n9DI/qLDNbdRivyup9lqU9tQrbjcmW6O0H+29aG+gLAJo7BGdKD4hW3rNIWeTy3+lXKAYuq2KdySBYyAS23lTbIPlZy36bnl1b3EdDnyARtT2zkeriHX195UvLEMqq24uhFYBHJDuSGFGz1OKZiFQIs8R1sAKnFez4ud+kLXo8K1yWXj0blmZcBZhYhUaxYnV6iWA0tHlyzLEFHhK+D11Ion+4Od+a1AN7oSAN0sL8qtnn1C0rm5XwBLXFpcOmoUZYpFgfpksNJxB9NL539sI0YazXCu8fnGw7RunR3bcRu4HvOn/XRjxlpxlTR0+vro1XfMxLjiEsgllbhf4u2dIA== 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=8/r3c2eEDHDTfs/lB1uV4D0ff86+H6mlR9e8ju4Bm/o=; b=yHUN3CY3d0VKuMjSZICfTq3ll8d3sQlavXDj06ZswA5+p2Kh7kCyDfFkeigUVZ5bi7sTpyTQW1shxT1LegA8+DRW+XzqXdJng2k9zwHlBHjUMo08CIuPl7NVYXnRKrSjuwjffiIhXFgXrLCE3PDWHhrC5a1jrU9WtgZLc2f9Wb8= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by CO6PR10MB5790.namprd10.prod.outlook.com (2603:10b6:303:145::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Tue, 4 Apr 2023 14:55:33 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%5]) with mapi id 15.20.6254.026; Tue, 4 Apr 2023 14:55:33 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 1/2] btrfs: warn for any missed cleanup at btrfs_close_one_device Date: Tue, 4 Apr 2023 22:55:11 +0800 Message-Id: <584322021db1e182838b5dc9d90459850e5fcf36.1680619177.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0044.apcprd02.prod.outlook.com (2603:1096:4:196::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_|CO6PR10MB5790:EE_ X-MS-Office365-Filtering-Correlation-Id: c91cea8e-7cd0-4768-db18-08db351ca40d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xIX3LVbQiKTN7OSGD6xTDpK86DxG0UIjQFKOioxWKRtp46KiAJB1JEqxkJ90dW/IU7cx8HfKAhNl3ABISk+e/uWOgb87G1B/GvnaSneNsOLGQ2wVOSCcKTlZTfAXvwRsG2hztjg7ZTgZHtdAp6U8BTmQ0qkYgJnAeEjTk4Fnbdf0UbL9c+YeiElWz5gtpepxESgLSphXeH8qhqD9oXteafKLUdJUFhe14Ay/zMg7rHBTF/4q3zBaE4wQH1u6q4DHTd5pgqCwWbxewA/fc3g0myZk6rHRmEt0qbZsidgjXDnAJ9Dpns1EXJP+OJkWZuAyUkJJ+O6RSGEDe9IVQ3YiRE31cvS+BeQhn+YxnsdBFZcD2GcokcVD4A6aNeB+t+CHLBka+1aSHMPClkdKfJqGgHq7ywLF98ehWZrBu6b2yxilmwy4p+9c9ukZqzddv8FpNPW6D2+WZ7zMbpF2W4Obx+1GFaYTFlFsDjhkmZ47Dv7GgOsxIURPOVFI7P79GibDFkCw5crYm3R8U8JooM43zKM9hhnqKQY7mO3hHJlptXS8Lhd1C5HuxIUubX2rhtBc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(396003)(39860400002)(136003)(376002)(366004)(451199021)(186003)(6666004)(26005)(107886003)(2906002)(5660300002)(86362001)(8936002)(44832011)(478600001)(66946007)(6506007)(316002)(6916009)(4326008)(6512007)(8676002)(83380400001)(2616005)(41300700001)(36756003)(38100700002)(66476007)(66556008)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AcU3v0XiBP2WkGUrsIksmw2csRfYfOJXvyjkUx7xFgQP2uIO3YwPPVooaEW0mh6eFINnX6qcLppj3QbJgzzLl2fTj7fnZwioH9onIo5FjDZYHx6ggYh8/T1KEDUmRKIlJmQQ5c0X2rqysCrGth9DCnjtB/umfktLsBlpVUChjYQbKWpsNEsWt16hME8wC0JCXJINRPESAcNqjQAZCVKNkKHfFvPuGJpSmKKlt8es0FwgzIT7mAaD3pSsqK2Ia2e7b7ZWWnxB9B/yR6ECIzQv8fSEBJZ7mn1VMbX+QFBh34cpjp0jmEBbTaFGZ3sOmoay/MDIIv9qhnz6gpqYWRXKqiUKq/Z01xJGsOZvW1eWKEmEIBln6K6NZi2oAazbvq2OBkAk+yUhPR6ps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OXJsT2OeP8NVSueKMvWaBiXV9sxqgmCGFf+l7NcDjK8Cq5N/25TeCC0hkZB136W6YOCxhOAqLUtFJa9/B7Ovu8YNfdJeEWQtS8O1le8AC0HMMX4/TeYxPtNeOAKe X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: X4sfUEdFeIP5T5HwK9ZuTXf7sDZqOHKhNJaNTzHQpBCaLVuC5CH4wj6RLDDjyBKdTz2eURyddfhqwvF01Vci9woLyeVPfuJ71XKfyr4TjyUSYqGKQbwOBg5JiW4hmN6Gkrkq1AqH3MPE3O8xlbjSSbZcMIUMlvOXTTlJVK2Oj3gVBTLJ/mRFjhR7cLyI1UlV2ef4LBb9RCpxCXoCAgfTqcJC3CF2X8YTIz+7d2UqiIZGKrmtZ1HPRPo2oybjMwXUott4CTjx9x2lFTyxvi7eTySsttOg76xx8qRiAcD84EgR4BVKhx39jmjFgTh77iAWpqjO64OGoxgcZBwGlf8g0c23UQ0RN0zzI5llK//eud7Ey5IkiAi6XCzDXe8EAAUzCiBzDUx/okXryE5ZkF3tUQXqqWBEOTDvfCgRnY8Dftd8qL95Bd7mM7MINIozPH80uMCZboxxLQMrZT5572GpbqLgyYU18DaNExQ9d2l0/GuLpGPAI14LOdsJNxMMKTdezxv8clYar1iqycoLCnNUp3IUvqb1dzhqLDcJlsBK5QF5C8ifZKP5491SAHapfIFYHFmG8La8Uvi081z/kn3b0ZavZrlUQRIDTwnw6FdxbwBpdDAIaaQBG3cONhrfvBrIbfixsTO6Rs/gQTCo7cRfQw83hrZZP7reSZUoI87TdVPtS7gY70HhYvioS1zX8M7bU+tKTpRoYF5pseMMmmhHpHE0EDQVFnPult8jw7M9lKBmT8H2CfusT5YgQb/RBgpy X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c91cea8e-7cd0-4768-db18-08db351ca40d X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 14:55:33.2566 (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: yG9rLqSKbFbGvzC9Md8Kw7B1o0jWfituSAoVGZ1b3fZ5pAN9SvOAA4uvQDBlk0x2mncW4m+bkdt9+c5xbed/sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5790 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-04_06,2023-04-04_04,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304040138 X-Proofpoint-GUID: jS9AFq884g3LLOqftvOF9cNNR_rgBVWn X-Proofpoint-ORIG-GUID: jS9AFq884g3LLOqftvOF9cNNR_rgBVWn Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org During my recent search for the root cause of a reported bug, I realized that it's a good idea to issue a warning for missed cleanup instead of using debug-only assertions. Since most installations run with debug off, missed cleanups and premature calls to close could go unnoticed. However, these issues are serious enough to warrant reporting and fixing. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index eead4a1f53b7..0e3677650a78 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1150,10 +1150,10 @@ static void btrfs_close_one_device(struct btrfs_device *device) device->last_flush_error = 0; /* Verify the device is back in a pristine state */ - ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); - ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)); - ASSERT(list_empty(&device->dev_alloc_list)); - ASSERT(list_empty(&device->post_commit_list)); + WARN_ON(test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state)); + WARN_ON(test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)); + WARN_ON(!list_empty(&device->dev_alloc_list)); + WARN_ON(!list_empty(&device->post_commit_list)); } static void close_fs_devices(struct btrfs_fs_devices *fs_devices) From patchwork Tue Apr 4 14:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 13200411 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 AEF0AC761A6 for ; Tue, 4 Apr 2023 14:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231661AbjDDOzw (ORCPT ); Tue, 4 Apr 2023 10:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjDDOzu (ORCPT ); Tue, 4 Apr 2023 10:55:50 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA4D30DC for ; Tue, 4 Apr 2023 07:55:44 -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 334DuUgP017267 for ; Tue, 4 Apr 2023 14:55:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=uV+UzZUnPLSTyHAApaWwqKOvZ50RBFRipFuX+616ZOI=; b=tOMK5RGUQjKIIpZkMRsJeH1WX1P9JD/+0MuedLgHvOpUcJKcpLAhLrVSrlkF4vBywc4r bmfm32hSreLr5mGHYd+J3KSRzBCyT+u0wI7g/8Xwzrd8XufElmYPARUo7Q0rWvSdmhyJ q4f3YqkvGzJOQE4A4w9ZpBF0+Rsigv/4pg7LqN8q39DMSxVZfQ/igMH3MtibqiG7CHuT h2CkesKPsp3DfvSMuEmZYfaa0qkmhezAO7n54b3Vdx5FBnvAHRX4fAP/4PKVheyj4M7V HgbJuPzm3fkS96kdHtlnwwWQj98o9Moxiif4baQpJ+QrVIDuM9g4LzyZ+hdVcBW+M7kQ iA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppbhbx1yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 04 Apr 2023 14:55:43 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 334Dfpwu002275 for ; Tue, 4 Apr 2023 14:55:42 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2106.outbound.protection.outlook.com [104.47.55.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ppt3h7nf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 04 Apr 2023 14:55:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyxyAioI6Ak/hzSUe4MNfRJMr3ifNW43jYG+4BGPwkkz365cvZUtkvV+mrjpd+2Vzkc3CRmnRcNtynU4Uls8LR9ZZT+8z1unMMyI0FdySgdSrvxx67i3M2EHr+e499oQ05BjEy7FozucHSSPsyO2EQdIpTTs+WaL+ukjCJlA1hln+5IdeWMjB2RPODewtpixlAvoQEugHUj1ubaykkkZFXvtN45/rZqzOIoLK3oyprPjGEgyeORO0mfXlY8ftgv8dl341ZZ7LbGirlFDFmgqEymecFJWKI0GoMMMYOx9tH6o9PqvphfTG8GOkQBV9GPHL/HTl6aUe4FoFOUtH5+gvQ== 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=uV+UzZUnPLSTyHAApaWwqKOvZ50RBFRipFuX+616ZOI=; b=RvqgHYPOjTR6/S9blOhDo/VVLSrEpdv5fkwq6Syoi9Ikp7U+X0aKr+QkbmJRu0rmRucfZP6kUlYOZqeG+mhaN7RG0eH2N6RbZ6M877SilEvSiBq2wzv5OZPnypLm4Hh+CS/qaUnJVMciEC1LEhUw+MFNlEqcsikk1ed2GS+YCYisTyro1gZe2/QRiA/qNIJcwX+2rjqyZzKfper8C5StrvktqL8o/YoYHpjurCbUm3IP4luUmkvx+vOgRMS/LycV9ajbg//mQ31/lMBhGOyVcdKoO6Uft4a902D+b3wxi4bnxXR8Sa/VMsAocnTnZRQNDTKHaKxZDyQ1JR6t0HSuBQ== 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=uV+UzZUnPLSTyHAApaWwqKOvZ50RBFRipFuX+616ZOI=; b=LOUYbsLEugySb4CiOB7KWX5FQu5DV5E6Mi4wSvGtJEm2IpYHeUHklWTHYcWpYBJpcsy+vIk2gOIR7afI/ho1RGB1mE6Ko1LqIGoBXuP0n7460e8ffhbEL9tQKpJfwzPbxyEM5sm9Gtvu0bvvr7iqIsvk9qTCNrT7dJfCA/r7YWo= Received: from PH0PR10MB5706.namprd10.prod.outlook.com (2603:10b6:510:148::10) by CO6PR10MB5790.namprd10.prod.outlook.com (2603:10b6:303:145::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Tue, 4 Apr 2023 14:55:41 +0000 Received: from PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c]) by PH0PR10MB5706.namprd10.prod.outlook.com ([fe80::3eb1:c999:6a64:205c%5]) with mapi id 15.20.6254.026; Tue, 4 Apr 2023 14:55:41 +0000 From: Anand Jain To: linux-btrfs@vger.kernel.org Cc: Anand Jain Subject: [PATCH 2/2] btrfs: remove redundant release of alloc_state Date: Tue, 4 Apr 2023 22:55:12 +0800 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0040.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::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_|CO6PR10MB5790:EE_ X-MS-Office365-Filtering-Correlation-Id: a821c8f8-1ee5-4286-c33c-08db351ca8b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5OOvCwe8b2N6NrQt3pvtDLtTriltETzmrrng/bAtndqzmI6+rJz7TPbO9+Fc/vp/uB2NTRhvARioVHVm1+NcerEeAX84yEkSTfUFb1mgeUheThclePuwaDz9Kzw9LaV2B3uAVdKuYH8vok+0PcTp6yzEXZl5osSxKElzvr9szcujjm9/6fnmUMGbjNLhEUrcldSrCtXV9uueBDwJPcKr5z5J8AMSqqNVT6TkXGamUc+szYazGtAMxJSDLXHZZiyg9QMLX6UFBymk9hmP+rgXmKLwDlhszOLkuylWmRBhsNYHf24X+sGH6vZiDo3iobx9ueCwMtHtATYvd+kz8Z8ezDacQz2BQXDRCdDm3wUVnBCl1iQHZ+z4TBF53f7yhSLcVS9bfIF/jgtpuZ3a6JcF3dBQ8S+VoZI5mWVjGknrQ3LQO49jlePzO0N/DUY2vwrd9DDgm42WSDQBeSk07lP5smSZpsMmggQsHWpc3EKqV5dFN1UtRqCMg50wO6Ize9vLHoZ16yBCEcCuFfAXXV2YoBAqXSSO76GwQohlPe+Fn6Wszru4KruxPegQSLfDym7Y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5706.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(396003)(39860400002)(136003)(376002)(366004)(451199021)(186003)(6666004)(26005)(107886003)(2906002)(5660300002)(86362001)(8936002)(44832011)(478600001)(66946007)(6506007)(316002)(6916009)(4326008)(6512007)(8676002)(83380400001)(2616005)(41300700001)(36756003)(38100700002)(66476007)(66556008)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qfR4ZPwpQWdGKR3Jwkk7Whan6rTYaKw18uDUvV7P1Sz9MbDm1uNG4BLl22BYZY9JGJapJmQrNiWv3bRRg4aafS6AE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DKHN44DhR63yv1uFNlftMpRNV1Iw3rbcu+e5hXZajLQqXss5SDGHZTzvjVbr0EveO/SlBX7CIpAZWWTOuAQtk14sHgABjj0z7afney+WlvnIGE7qlwoM/3euF2bF6QjZmodDLObDPQ+PTOBxokRTtVY7C4CnMIEN59LTO2PVL9GxC5Pr99G5FOwL4VcMw4dMxhO5412B7/40rzg5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a821c8f8-1ee5-4286-c33c-08db351ca8b1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5706.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2023 14:55:41.0317 (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: 6etKEWQfN8m8870eEzaGyumkjZHNtDX1bXw/SCRZjzPIsEskd/mSfxLdFK3GRDDrdpkuVaOfnvaGCOx3rWhchA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5790 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-04_06,2023-04-04_04,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304040138 X-Proofpoint-GUID: Hf6TMAdhWYV1t6O7fVOE90dmZ5N_C8FN X-Proofpoint-ORIG-GUID: Hf6TMAdhWYV1t6O7fVOE90dmZ5N_C8FN Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Commit 321f69f86a0f ("btrfs: reset device back to allocation state when removing") included adding extent_io_tree_release(&device->alloc_state) to btrfs_close_one_device(), which had already been called in btrfs_free_device(). The alloc_state tree (IO_TREE_DEVICE_ALLOC_STATE), is created in btrfs_alloc_device() and released in btrfs_close_one_device(). Therefore, the additional call to extent_io_tree_release(&device->alloc_state) in btrfs_free_device() is unnecessary and can be removed. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0e3677650a78..c201d72f798e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -395,7 +395,6 @@ void btrfs_free_device(struct btrfs_device *device) { WARN_ON(!list_empty(&device->post_commit_list)); rcu_string_free(device->name); - extent_io_tree_release(&device->alloc_state); btrfs_destroy_dev_zone_info(device); kfree(device); }