From patchwork Thu Apr 6 09:30:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 80148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp894215vqo; Thu, 6 Apr 2023 02:43:58 -0700 (PDT) X-Google-Smtp-Source: AKy350YkhatEaJLoIwFO7RPUC1mgXE68hKQZ9RztEmkoMggcMS0M2ipJcZ8UTOXMfq6MxWRskXyO X-Received: by 2002:a17:90b:33cc:b0:237:40a5:7cb9 with SMTP id lk12-20020a17090b33cc00b0023740a57cb9mr10431945pjb.5.1680774237834; Thu, 06 Apr 2023 02:43:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680774237; cv=pass; d=google.com; s=arc-20160816; b=sXeZdUW1T9eIJaf0Mt/KSfKivg78wKzedPlbSYUTnfHcObOp44RI5AX9wB+uoupgOK 23uHkaKqXDhmb1SC63Prp05MZlQMMSpr74tUP4ZeNCO7plwp902R1BF6cFtropPGdnMI p1AcaZcwOxeTSrGf/7FdwSR7tfv06Z/W0P9vOwZ7BM19uiEdT2fG8XG/NbabclAXSP4J 6+4borfdxJ6p7PjOLTNIsc7OTm6wG1o5rvNaqIy/tYXbnpQ/Gts3f4XRDGbPkeqp+m7b zNcFegr2bE75+Elso4/27mprNNr65DvAOaSIQ29sz4zeJujOFVdjoXti+ZrgS5/FhoR1 Sq6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jx3LPpRVZASZ0NonrMCGIl/8nEX/C7veMEX03jGe01w=; b=BvRypZBZAnAK0LBo5W5VGJ9yIzqSPdwUIRC+v8LzjMaiE5u+xHs4neGOJ7VGh1JMgz bXzUw1H+3lTCOYbcqyB+aswZ249KOT1sgebKfSPq2dupOnKHCvbX42qSU8d5TZ/w/2ys 4zeCsiZ6jsJFF83BlFxIZOzBTK9JXR6ejQPFJO5iy8bdauZGztUIez57OMSH4MbgxvZr meRrYQzsbzh+U2xd2NkyohCusVFa+W5LagVKsiYhjQgemwRIY+q64cAtTxyTIvAIsmU3 4PnnvwZOAW8FxgA0RpqcOaAV8hHHDax5e//k369pvkUsPVB+od2G+S0qnaom48/zBNCE x8rA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=NJclsDNP; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a17090b010400b00240ef97dd52si900078pjz.159.2023.04.06.02.43.46; Thu, 06 Apr 2023 02:43:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=NJclsDNP; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236425AbjDFJbR (ORCPT + 99 others); Thu, 6 Apr 2023 05:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236409AbjDFJbP (ORCPT ); Thu, 6 Apr 2023 05:31:15 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2130.outbound.protection.outlook.com [40.107.117.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F3D865B6; Thu, 6 Apr 2023 02:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YqjEbqHURaqcMLCvpVJkcjX4DP8yETLaDjThKMW8HWZkR63Q6iGS0jKbPXAYVR/zEMOvm4gikyi7P31fFgptQYsZhmIm8d1c4GM+6lanF2tvePsOoNhmPJ6XPzeVq8ZlSnAY5LxohWSireDEuGj2LpvVJqgJQSBrOyJXdtZaXclMAvljTvGY7/41d8Vi9ynZi+dYwqTIja1QOEO+clRYE7HB2nog+5hti83dA7O+YkjqD9GEfHYd+PwZ2gp4sCXCZfuAeXzYggCPGmomSYWgNzg2PYZk6NH4wQL/YPeM2+lXty87p8YRzKvAInYTrH/8vdNbTYTpwtCkTxIY4b7sAw== 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=jx3LPpRVZASZ0NonrMCGIl/8nEX/C7veMEX03jGe01w=; b=gwe03sjV9WeSxiBXNfHmRyFuEySvlvB+eP294bWGqDqhEfOoKvwbJ7fEJ3APwSEUFPfHgZFoPP703HSySwSmw7dvIc8oJzUSA7A8D889ajfHYAZ+xodgp7ufKwO/+SfMIEKD4KAiboT64BIkttdq0lM+mscyXu2GeRNKezRzaG4VwK4B8qarx1klLw/E7a1/6aDIyoWj0d8oktGx2CWdwFyiuD3dZMWksVQaQSAexKPqRR7cKgR6ONRBOhSEdHou2NyNCHq/5m/Na9Tr5o3Y63/3D0ruXAj7YnLEca9jSMkMs/pMDBSEAk8eGgnCNz9HgkoNhOvcHohQX44NRz0clA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jx3LPpRVZASZ0NonrMCGIl/8nEX/C7veMEX03jGe01w=; b=NJclsDNPTmlnWMMiSnhaZJOPVDvcFWDsY/whInLqg2my7dJ38Twlls71zUEBtBiwFucAgWbLQ/N5dOi7tfI+CySKYS7v5KAuIkjl7YWreQiUMpQFwYZjm0a6a5nhWxMMYdPEonEMHSQEF8yb1SNIyUCmVpZFrUwWnrMa/9e5oFCAs59tPE+XFtmlu3LI5bJedzQD1xuJ0z304aAGYE2dUCtQDyfiuZsXTyxALrGD9RgWloJRT3MIOcXftg5NgrN6ktKZP87lpM67f9onaffCHFFW0zP6uczoDUBn3Nme/pslWMEn5csrXcSCtSdfFqmfQ/QVPBMVY7Ijt1xy2Yp/YA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by PUZPR06MB5772.apcprd06.prod.outlook.com (2603:1096:301:f0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Thu, 6 Apr 2023 09:31:12 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::16db:8a6e:6861:4bb]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::16db:8a6e:6861:4bb%5]) with mapi id 15.20.6277.031; Thu, 6 Apr 2023 09:31:12 +0000 From: Yangtao Li To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com, damien.lemoal@opensource.wdc.com, naohiro.aota@wdc.com, jth@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Yangtao Li Subject: [PATCH 2/3] erofs: convert to use kobject_is_added() Date: Thu, 6 Apr 2023 17:30:55 +0800 Message-Id: <20230406093056.33916-2-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230406093056.33916-1-frank.li@vivo.com> References: <20230406093056.33916-1-frank.li@vivo.com> X-ClientProxiedBy: SG2P153CA0021.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::8) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|PUZPR06MB5772:EE_ X-MS-Office365-Filtering-Correlation-Id: 8170c1d8-b98d-4372-ff9b-08db3681a912 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 72ZPUACYtx/YRirpcMhxSmSupxy/1cYwOBu2VRNOkxpUKzY70bplrwgIRN17u8+H43D30OaqPWlTShbFDVosrcZk1m/ofO+NTJ2UcBjhGHbQHVPzLOJg+YK6l/jdXyPgEYALqTDURxchSfsqRbYOgz/p0uJjByQWzUHpsJu1KByZKXY+DvGlZe5TvSXVwIqIFi2oPxrTSV/GnnctZ3TxD4x+L7nTrjElDDyqIQkepj6wRKLWaskhB+o244bEW1ap7WjaYa2YN+JhH4mwN3Q6Cxn9oXxUnctBhC3OE6V6wsR81jOcbBSvD1U7m4it/4/KWgin1hiilBFuvTLX94TxSjhxnNC+8TwCzyaa1qCrh1SeKE41Qt8rwqMkVcTtYmouZF8QKUycpbFc0xd47Ht+zlwqWB/xLhQlJHJK0s/UCsMhXnH+DqqhKp0BAIJatKQDTbGTbJLETjtnynfi6nKNwEmnkzH24QiUSmsl5Vz9F3/Ao/fUTnxesutZAJxY1HIVA4neNNcep4+WV52583Hzj0TC5E2Ls6SUXplOspl8iCTuVDrSWQzW5sFrjeTH+uuap2ThHGQ3CVHYPM6NAQPJgLcUPEqwdfmSO5SjIPvGhN1Nr/475CRGVaW1yAwFbm+C X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(376002)(346002)(136003)(366004)(451199021)(4744005)(86362001)(36756003)(2906002)(6666004)(2616005)(186003)(83380400001)(6486002)(6506007)(6512007)(107886003)(1076003)(26005)(8676002)(4326008)(66556008)(66946007)(66476007)(52116002)(316002)(5660300002)(38350700002)(38100700002)(41300700001)(478600001)(7416002)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8xu4ODqKtAEl1g7E56zucgOxpsbcH9SlAcjmR8ueI2nrU8hvfWKC3AHqkiBeV67C4dD7uK+b1EpisG7emocEAqwqOkrGRGD5N8H3UYCars6Kz5ILiLYlke5APEP9fSc1ej1k319glHbQS/vovIPPfWF5/3AUqSxIvJq8Ljgz6GedjIjiVWZuX/84LGNjFbgraHdm8+P/pfi1CBnPXZ1ftpqIjb7v30uy0B1jefCiWV1yZD7y5DOTNJ3hMfPIQk5hg1gZrtEj1mbTSYw0sXEq1DaKQDIdJyEOBOK/W/BHitV0peWOghgs4M28bi8wbnXZqNIM54LENo90IRM6SXoCq5mwEpI/KplzQEf68eQugLQv3Su18mf9UVGAymh3dUlsbmrf4XoPAC6BXcvz8H841nTSBTZRLg3v7QTnVr6tLRXAvq1k0NXZ13E4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65lJ8UEaB/JS6W+AYoDSH6lyNY27RruuRw/hKSYuaUaCuQv73mvJGt2pVomsdXh51cDBz+MM21 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8170c1d8-b98d-4372-ff9b-08db3681a912 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2023 09:31:12.0469 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ucu/GWhOFtHHd9+lmAZP+zHCRhmy8WjLG6Owda8gfhS1ot0DwgzrvJF/ixbprPVuVtsZoo7q+Bl1MR1XyI38mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5772 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762419527142315493?= X-GMAIL-MSGID: =?utf-8?q?1762419527142315493?= Use kobject_is_added() instead of directly accessing the internal variables of kobject. BTW kill kobject_del() directly, because kobject_put() actually covers kobject removal automatically. Signed-off-by: Yangtao Li --- fs/erofs/sysfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/erofs/sysfs.c b/fs/erofs/sysfs.c index 435e515c0792..daac23e32026 100644 --- a/fs/erofs/sysfs.c +++ b/fs/erofs/sysfs.c @@ -240,8 +240,7 @@ void erofs_unregister_sysfs(struct super_block *sb) { struct erofs_sb_info *sbi = EROFS_SB(sb); - if (sbi->s_kobj.state_in_sysfs) { - kobject_del(&sbi->s_kobj); + if (kobject_is_added(&sbi->s_kobj)) { kobject_put(&sbi->s_kobj); wait_for_completion(&sbi->s_kobj_unregister); }