From patchwork Thu Apr 6 09:30:54 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: 80150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp894781vqo; Thu, 6 Apr 2023 02:45:27 -0700 (PDT) X-Google-Smtp-Source: AKy350aviMJ63Yw++pZHyqNO4RXxiX/dkyxPOeRVfS/K6pxmjK3kWYW31CBWS9e2NPjylnM32c3l X-Received: by 2002:a05:6a20:1610:b0:da:d4eb:9e07 with SMTP id l16-20020a056a20161000b000dad4eb9e07mr1796111pzj.30.1680774327446; Thu, 06 Apr 2023 02:45:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680774327; cv=pass; d=google.com; s=arc-20160816; b=sz+ggdojeto9vyB14ZWfXy/HNV5hERfWPnEYizhxk55xvE8RP5nI92TqbUc8FEmEcl X2lfBIpExoUnHuO/aWn78td93mFyg0pIfIt5am9mqfuKVgY+4vSd8ZITnWxZeh5NxiXC yJJHAFWpYrEe9ZS+Ak7CMbEe6s83fFmfEJgc5ZblF/xOG+uIpqpSvekGekhMNcjjAJO0 PtcxzUCYWSdEnCTwWRA9aqUWg/p9TLHc6bI+PWNbc0W0VX4+44x/heWMD0T6ypQDBRPn vemcakn5SfupD3SsYxcf1tGCQQjzcwCZ+ynmhxzax2Bxb2TSdhDCpaXNvUh1tLj6Bt1+ 784Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=3zqjim39DIisZ7CZ7Sr05kyKwRd1flA6zfSGRc5ebc8=; b=Y4SImvHzC/BpvUSTMoKa31vLzpwD2xh7zRDwL5dWtpborcyc1Ta5bL5pCUMV619GMe SlRk+b14eMAWC1yONYHrZqp47mDYYSjN4IJbE+ccLARXu/T8ocvrNSeIFELL4+u6tx9y i+Qp5yd0kqGyXgWEJgGZNZN72C17am941iJKfi3cQxauz1R92J8Xyjx5LLtFDwND12wU oSuYd5IpepxWWsWt3KpoN5rnBorHfNNybAWdq6lea5x2rXTH4mi6HDvCy+7nN1NMaioa c7/3c7dgYmgQnXqoT033sDMrJtB5It/M9jGYyB9NwI+Iw0M2SPPH9lqZ7TgEuG52zvrE RE1w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=nT90jryq; 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 w23-20020a63c117000000b0050bebc3e35bsi836859pgf.766.2023.04.06.02.45.15; Thu, 06 Apr 2023 02:45:27 -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=nT90jryq; 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 S236408AbjDFJbP (ORCPT + 99 others); Thu, 6 Apr 2023 05:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236316AbjDFJbN (ORCPT ); Thu, 6 Apr 2023 05:31:13 -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 4F98410FA; Thu, 6 Apr 2023 02:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gcFmYr6KYwAkosT5TDH2roHuJ88shha0kSK+IFYEV/ccQqpiDU7Ewj8Tlri8k0MAhSkAlAlfFj3TDCzw1FWt2wBslFTCcyOXbI1lXLL8M7uPgIRdhyCAtRbIyfFTm9XwcKuC9bH3Jp0fzUc1XMWDuodTUE2ER/Y5pGOphzLyABWiOR+Jrcn6l5ROqdo+waSoThg0GoUAOowmLSFZoo2oljGwI0tUmIWb3a8wPqIbe50LMFPWJ1EyFAPK2kFevQ/66O110KnDDzOqxQQrq+Q8On+Ba7Q9pRwt76Frn4CqY/G208OtvaVcMQhScdPjPjm8jalsYuvW7/jjvEQKT6kypw== 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=3zqjim39DIisZ7CZ7Sr05kyKwRd1flA6zfSGRc5ebc8=; b=Pk9SkjhrjPFCpSdEBH7d8coDnyPF6uW7GD9SOj9OgwREg5We6Su8g/xNloaqGAB7nxRjJJinnlrf61fAZ3TTr/bXGcw/eS6b3sArslwe8n6O7f7bWu6g5gg35JNQnTTlH4YNvtpT7jcGsIHn/80uitoH8DjqbYMAgKA/3V5x2/ycKoliGx/4X/5kQ18s+dnrJUaq20OR+Lqz9VS8Mg70PBM7gnN8GRFjCMSImogI5QZsxn6lmkadocXGzs4GX6iwJrOvRNXlWbIErDqBrvwFIDyreuLJtiVKkXZB5jy3a/daX8FT0tZt8rvphCRMSllGzsBOa3qgpEbP2g1tAtknZw== 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=3zqjim39DIisZ7CZ7Sr05kyKwRd1flA6zfSGRc5ebc8=; b=nT90jryq0ZBULWCGCQL9k0EM7pJFkXcDMPjWcQG6L+5VxcAQiJK2Qi9lp7Far4cW2mONoMp557Ye72vUjmaK17p2BPiCP6YdLLIU4//WVJpcRU/eU9W+0KOVeK5hai6DodpQHLvUuxF29x9YES4HB+PZBGcBRLyMS5wDQ1qNEKIbcIw4HFcgYyKqOnRS05y7t1t5BErdAB8KwK6Mvh5cs4z4GQt06ZhCVrLgx3HDKAvKvOO/yeCa6o5Mb2kuLt7tW7IFoVp6+U2+Jdv/Vgop8NmV/cmw+PDP2h4a+BhyR1iReFR9tSQdvyO5OOFLp1lFmS83OGPD0YADOih9t6ktpw== 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:07 +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:07 +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 1/3] kobject: introduce kobject_is_added() Date: Thu, 6 Apr 2023 17:30:54 +0800 Message-Id: <20230406093056.33916-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 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: 0c7899c5-a214-42e7-cb0a-08db3681a653 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bDHTM020T8uZcPYTGJhHQhaCVRysAeGuI1AN2aI995bgol5eVVdmRHusPomrtUChT7Wv/dbv/NCHxwio/uNOxLfneC0vATPbBLshT4KXauVWNXFzn9duFWJFukGrrjjlXxeEnoHItK52M27/wVsal9CeEN3vP+8B2U6UeCk+K0Aqd3zobu4mKKEBsQqw8Wtlgha4YyXXJ4GXXKgNDnr/YlTy6V89kzoYi0uXEdEdMF740Nvosn/Y4PKYCcjNx9qz8lUN7jtmUFL75EB1hP/1mZ4I9jqTorvuoG5rqaW2L0rFWtm857KmUAcZLMM4xfMMzHcCtTlsNXNqaWuKlRG4qJMBNNs807poEIpQzhe0dUk27exrZd1x/REBflnWTTXfxcY3C9JtNOWmf9IHv/dllZ8PeB63lYkKOU2pVV7JufmU+a0yMkO9cORp56n2bsKu7nVGJBkM69oXQMGnSYz/Q6MUlbxOFcjt/R6lCZCUrDofwWHjeGoWdEfAQ1sXOpBJDi0x9UHVveFg/7d2DYWbo7mvyaAHFMydlCYPtV8eAz1pKUfj0JI/wr43pIr2iTflyTIjGs1opf0CbGZutEhHrZAyC5wvdLbx8OoHyOGlJ6daLLx/dOrIcnoOXh2HhYNA 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: 3GqxyVR7oFg05vhGpizd8Pupng54OhHyVB5zH/gLqL56uhNUdKoLt1fVjVIwUZTkmuW5plrkumZSIXkQv8rtHiKHl3O6PDUFvzUXet2rs+JZi5k2z+mB48qAYa5a62yAtCJul5yVAUJ0FN9TfNP8rKFWIA7AoV2uc1s7BJbLkuS6XOUZZHH5FvndXUHUFrasZ7BrDcVnDRhkdVFB3m6jLG9sOXLsDvLmV7RVCMwHxsRTyhx+K1vSWLILCQ8mm/khMV4xSSchVnaYJONqOW9szevys/70d90BGZcGzzex+WMQx6e6oWi1Wp2nNovU06CFJJtPmxCr087fRo9eL3Pcu90QQk/zRywikP0Ib7v/VZsYG75PKQmDYFFGtfYhqiTajRoSROn5cC8E15HoXUynMtGgAfrCf0gO8fX050LDgooGNAxtbIh6oXjwKcQeIAFYwbFjTbHhXA99/YIG37+aqPwTjMAPUi/qlaNMfCJhv5xTw26Ofq/8h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Sz1Yye X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c7899c5-a214-42e7-cb0a-08db3681a653 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:07.4602 (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: z0w3m0qMc/Ib2fuDaXngM6BgK/Rl16OcahSsH+iLWeAItmw0atKHKnAXSJZSOjX1/p5S7ERVtmAGAOxdWLPpxw== 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?1762419621405968237?= X-GMAIL-MSGID: =?utf-8?q?1762419621405968237?= Add kobject_is_added() to avoid consumers from directly accessing the internal variables of kobject. Signed-off-by: Yangtao Li --- include/linux/kobject.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/kobject.h b/include/linux/kobject.h index bdab370a24f4..b5cdb0c58729 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -203,6 +203,11 @@ static inline const struct kobj_type *get_ktype(const struct kobject *kobj) return kobj->ktype; } +static inline int kobject_is_added(struct kobject *kobj) +{ + return kobj->state_in_sysfs; +} + extern struct kobject *kset_find_obj(struct kset *, const char *); /* The global /sys/kernel/ kobject for people to chain off of */ 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/KplzQEf68e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VJrSHYj466J3rB9CRKE3D7iojBp0w49acGWmj2V25IxI/2avkEKnkq841ss74rT/JYHt4AAmLaaiV9GtVWpNX0g65lJ8UEaB/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); } From patchwork Thu Apr 6 09:30:56 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: 80149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp894736vqo; Thu, 6 Apr 2023 02:45:22 -0700 (PDT) X-Google-Smtp-Source: AKy350ZhdyrYlTnJMY3Z5kxLZelaX5DkEXD6jqMs2ABX3AMruUTq5uumgJSSZ2PZvg+iNxsd7LDz X-Received: by 2002:a17:903:22cd:b0:1a2:8924:224d with SMTP id y13-20020a17090322cd00b001a28924224dmr11322404plg.59.1680774322065; Thu, 06 Apr 2023 02:45:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680774322; cv=pass; d=google.com; s=arc-20160816; b=LKVVRcoSFE36lswRXdZ58E5Obg7gw/LIMIZQy3n+ijFIZK1Ckcy4GZElexeByT/h1Y qYEY8BAWMUy4cXnylhg1ZiIlX9fjvW8ukrno7/RXzCEvWAoPyG1jbT4WjVe2CJInUk8O e9PwZ/HloQDtl4jmv2vTIsz/ppNvMvsK9ccuZOvF6KWM5Zu2swMlGSRiMdeOvbf4M/DE 04FufgfXD3zcvbVMKIek+EsVhHfP/My/2IqSZDTMIr5dcWUXIj003tnWKXdIN385KEnv 4CkZt1twgriZhzxAUs1YrVzA1lHCYysqG0Ubl16RmNG30YkYWThlc/Pyh2d4jt/QJt+a XyKw== 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=hxFWt74cFA6U7xiEQPD3j3AhIO/HZzzekr8xd1KIoPM=; b=T2fb66D9AI3Eekzw/bcFIpghy4Sr/3eJwhQCZcYiCIiUqlMGLtEwRBGVYbC+45/HVC RyHUgmnPSY1bCLMICPElVD5JC0g5B760kDqStLUR1MufWm+DE9XgbQ5pZGoFOvETxKI2 M42NUl8IA09S2G6pWo1ocLz78+Xpb8Zy3E3LYKX3pDHTO3xQo/IyCK50b1B+AcUEieb3 FTa5plb6DN+6vRk4s/e0/1OeG0Csh0c6yzTN4Uv6fyG2sl/ga6xbu6tJY9toZLUHKmQq 4ZNDiWTrXbFNizOoT908sfYTPcdPmiwmpfirCSx8dirvp3VamoZlA/v05r5VPs90dYph GxyQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=cDv1Gdbh; 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 x28-20020a634a1c000000b0050f66d4e070si886999pga.417.2023.04.06.02.45.09; Thu, 06 Apr 2023 02:45:22 -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=cDv1Gdbh; 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 S236464AbjDFJb3 (ORCPT + 99 others); Thu, 6 Apr 2023 05:31:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236438AbjDFJbZ (ORCPT ); Thu, 6 Apr 2023 05:31:25 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2118.outbound.protection.outlook.com [40.107.117.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3CE476A8; Thu, 6 Apr 2023 02:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QQKq+Mx6Sut3+d3f9C3nCm82dNBsnY3dgo411jPS9hY/SihNY386LWQ99oFudKjmP6njdERzuiPdteSQuUGAarkw6+baUyx/YcgQNGTjLEWTmDZsEQzn402Gy8UhTA3uQiJl8ToAXLcBRCVxbxx84V97+3Y+7hElqJqlwuiwYj/p2u6MecX6PrbKc2mqrET5x2rkcCC40YzMcntjpukkUxEnsIaqfJHvL5pgaZkqVeX8xoY06IGZNM6MHmoqBHsu/d5auNASI+bXZfn689T0gK8qSXjQ7sMqMh2bnbNstSqXXRGyzzlpKb6ydt7Cnetg+gYcZ9hd70aeCDsufMgM/Q== 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=hxFWt74cFA6U7xiEQPD3j3AhIO/HZzzekr8xd1KIoPM=; b=cUl0q6beqYnqamBXhT5H7mT/xZdKdgTQcbWXDxn2m5QCk4bzlaiILD2p82EJ01lIHi0D58CLJdALm4m8OgFKq1tafLbumK+kpxb95YfJnH8kRaIVac8NHDjZg4EFYycuTUWk0h/VgdwgWWXNYcel6mGzwG3AFAIyW6FTo/obGVHOIKHRPq0x+0ZZTgxmQ3fErdp2Sk+vq50vpVC6Zja+joV7/HnFP4DkgUOjeL30ycdfNTQtf00B/yU0gD2Q2loIe297VWDMp3zOQ1nrRT4VVjvD6Dgri3BY2v/ccmEJnjRek0Pu8RzFUTOOO0s6vhXFMbhUdVhmC4cXaubqiEXMFw== 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=hxFWt74cFA6U7xiEQPD3j3AhIO/HZzzekr8xd1KIoPM=; b=cDv1Gdbh2s3AOWCOyBdL96C1SpAhDfABo1IWK3qbMBJskfdPOggh3DmXLYzgTPFDXo0tlPHLSHwoOVLllfqMtKCJcYkKTOAhjE8r2Id1PZJptK+3am4o1aPSNs0X0261cRxg4FdN44WxAnuoajjYOjEhB60Wpqa0UEtQaZc4tiChd0e3PZJZjIHNmemB9Mrkco5g8mkJp7S9yCl+1yFNwb02VGZ75toxFS0ODun61+O2sEBs3R7fIf0Vl9ZVF5x3RRcI14tPV6uYZCIV7DFPFPHAiocypvxknhFZMmGIzpxOaVQenYZKoSZ1geI7Uh1/emSNpIkLYz0Bll5W6i1rlA== 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:15 +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:15 +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 3/3] zonefs: convert to use kobject_is_added() Date: Thu, 6 Apr 2023 17:30:56 +0800 Message-Id: <20230406093056.33916-3-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: 89492d96-0959-42d3-9c3d-08db3681aae8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +of1lPVNrqjBhtxdLYDRlXpSUQUexuwJo5zORGUqcoTOuD3RRZdxWbfpMHxHhFWRz1n9M4zx4I+m/I1TkTtVFWHfXzlkLGlNU6zfbhHPSYZA5gtvRPf//M3xifviCbPCGxW74znuViuKPxHfxNIN8udktO3hQFlg+HVmoSZl9rOmEKTkyRh0Pu1FKEG63GBs2yyZSlS6tU9Sn0reQFdapn4yfqtc19BSZt1aL8o8XrTKC4E0Q2dNYV6xvhaM9Dp8SO8p4VIreAu7R7do1i8iMW8UdjvgQEXsHWL18muZMUY5JI4t1P+V3EVh2i6X1v9IJx/ezcMtgnfRoPFLyOm6NoKBA1GG6FUdtX8TrREjUlb2mE63GZiefGnML3khk7CQLAU8detcltOwOazudfBLkn5kppqVdQzFDtNiKtMOG19pilpDG4Fc5WwV9c2vNpLE21h0lMrx+igdLmMV2/OFDIGOiV2er8D6lZ1khialTc56c0E5eKk3dGq3PfcmJL709K5QjvGTBqwvFkum+HdltBaVhdsc9PvZE7af+0j87gevtLXw3GgrjcoGFNm09nY6q4HFkQlIN3jvY4jhOzKuJ450UNLVmJkNHpwOe6/+j3rFH65eIbf5gJkYCqt6j/dx 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)(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: lMO92vDo2PiinmK+5c8YUwipt+pEEdLz1T4Orjm6Cz1yFsMx+enxLGll44nNIU8s/e+eFk4tuM21297baNvI8UYNRy52wA0mzWYb6v7XkJDoJh6xXryuqx+3uRBceXvcLqLEbl8W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2sWuklk7sA3qB/vCJFV905sHRsSX2uuc735FsNo70go4rfvQPWoIiB9Qir5Q9Fjje7Rb/ks992UtQI/PZuFOKdPVb0z9Nh+LZoqgkASWuU73gfco6esjuY+OlQS5+0qAcgc8giylsC0utynVBhEr/Y16g/Qu3AJc581m18UPFM+tbfvQsxGGXPj0ZhTLooiyJvjx6Q2MTEa5VEQRlSLL3BdbN1WlTG3Xu78Qhei9BasYCwM3DrCuxpxgsbPJevuSOvbWZ5TM/dYUyYFsjk2/gP7+B1v2XmW7FdVJ/DNOUu8UGjYV1T/oJwpMtS6i2wCK74FSwk8ygOA3xsJ/DuOULUrie8Vy0ZBm40z+tT80+AOK/U2tLygpqUSZv22WgzOMkW X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89492d96-0959-42d3-9c3d-08db3681aae8 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:15.0418 (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: VLclSE4et47LFAX8qAr0rbSbYogvfxKwL0Kzh41GBFK4BqXHGeTMRW0RwsDFfxdOF5OwB6LAk274bGl10hORRA== 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?1762419615117454297?= X-GMAIL-MSGID: =?utf-8?q?1762419615117454297?= Use kobject_is_added() instead of local `s_sysfs_registered` variables. BTW kill kobject_del() directly, because kobject_put() actually covers kobject removal automatically. Signed-off-by: Yangtao Li --- fs/zonefs/sysfs.c | 11 +++++------ fs/zonefs/zonefs.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c index 8ccb65c2b419..f0783bf7a25c 100644 --- a/fs/zonefs/sysfs.c +++ b/fs/zonefs/sysfs.c @@ -101,8 +101,6 @@ int zonefs_sysfs_register(struct super_block *sb) return ret; } - sbi->s_sysfs_registered = true; - return 0; } @@ -110,12 +108,13 @@ void zonefs_sysfs_unregister(struct super_block *sb) { struct zonefs_sb_info *sbi = ZONEFS_SB(sb); - if (!sbi || !sbi->s_sysfs_registered) + if (!sbi) return; - kobject_del(&sbi->s_kobj); - kobject_put(&sbi->s_kobj); - wait_for_completion(&sbi->s_kobj_unregister); + if (kobject_is_added(&sbi->s_kobj)) { + kobject_put(&sbi->s_kobj); + wait_for_completion(&sbi->s_kobj_unregister); + } } int __init zonefs_sysfs_init(void) diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h index 8175652241b5..4db0ea173220 100644 --- a/fs/zonefs/zonefs.h +++ b/fs/zonefs/zonefs.h @@ -238,7 +238,6 @@ struct zonefs_sb_info { unsigned int s_max_active_seq_files; atomic_t s_active_seq_files; - bool s_sysfs_registered; struct kobject s_kobj; struct completion s_kobj_unregister; };