Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1931039rwl; Thu, 6 Apr 2023 03:32:36 -0700 (PDT) X-Google-Smtp-Source: AKy350b5ePK6zwWzL2xb9WRvz48ZOshSl6923L8KKhCExkS71TxSVp4QqTPhFh2ZEs3bhFG4r00D X-Received: by 2002:a17:90b:1e4c:b0:23b:2963:ec94 with SMTP id pi12-20020a17090b1e4c00b0023b2963ec94mr10520641pjb.29.1680777156358; Thu, 06 Apr 2023 03:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680777156; cv=none; d=google.com; s=arc-20160816; b=Q78KcQ78Z8aSQc1J1OrFoRrBGybpXbAVoUKpzi2unw52UHv8OuzTfAplL1sxqYffO4 +JARm+KP5DASv6hnAnVw4FBj1WokpcmmOsRI26eOb2gCM5S5YcuVoFatERnOS6iy3k2F q39W8qTyw+0inzQLv/VDNewXG8oD8n8IMOAzdxgeSuRS5Bqtmc9xAx2xjWh759soN/d6 0UOObj5A8wKRPnOWlZ8qUyuL+PTmmRlAnJV1qVaab5U/lDKTP3Cfq4vpRsbzd3HE6Zbi /mZI/5Pf36U+5I1iu4vFP5995/UQQLiEbd8IZqhWSdScUBdONptgOy5uhkVm8kKF6jS9 2qew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=MAD0HpjQ3x1ABDKNlWfyJW/lVrjV32V5n5WiNE41nuE=; b=euVUbtZz4FZHw77te8+xtq61Cg093oa/ZlX/NzRn/ZqHnBuA2hzz40oLMr16HaAE+b vVf/aaNtwD9Ws/ZTnCbtXX6DFzfLEkAsXCXpqbN4A2HCxpOsrEpaHNuzC52PS5eZNWWg FvedPl+Pg8zD9xdqbgHV1BjAD7K1lMuTZk9MEfA7oHEz8AFnXzOq+qVndBGyCzSxz5E1 Zk2gWSf8QuMNuQjBUXzzB+xSFPDOYFo2RsdsLLjF7WM0zK7avwAMcwuiZG2UROguQ++3 oMSSj1EcFORKeT9tlp2jIDH8dWnV/zXENaQAhoHVrFD2BXEjmOmDyLwLYePEU+uedL+i h2iA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je11-20020a170903264b00b0019cd505cdd4si1308506plb.236.2023.04.06.03.32.01; Thu, 06 Apr 2023 03:32:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236373AbjDFKNO (ORCPT + 99 others); Thu, 6 Apr 2023 06:13:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbjDFKNM (ORCPT ); Thu, 6 Apr 2023 06:13:12 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981B51BD0; Thu, 6 Apr 2023 03:13:10 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VfSm3Uv_1680775985; Received: from 30.97.49.15(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VfSm3Uv_1680775985) by smtp.aliyun-inc.com; Thu, 06 Apr 2023 18:13:07 +0800 Message-ID: Date: Thu, 6 Apr 2023 18:13:05 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 2/3] erofs: convert to use kobject_is_added() To: Greg KH , Yangtao Li Cc: 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, rafael@kernel.org, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20230406093056.33916-1-frank.li@vivo.com> <20230406093056.33916-2-frank.li@vivo.com> <2023040635-duty-overblown-7b4d@gregkh> From: Gao Xiang In-Reply-To: <2023040635-duty-overblown-7b4d@gregkh> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.2 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 Hi Greg, On 2023/4/6 18:03, Greg KH wrote: > On Thu, Apr 06, 2023 at 05:30:55PM +0800, Yangtao Li wrote: >> 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)) { > > I do not understand why this check is even needed, I do not think it > should be there at all as obviously the kobject was registered if it now > needs to not be registered. I think Yangtao sent a new patchset which missed the whole previous background discussions as below: https://lore.kernel.org/r/028a1b56-72c9-75f6-fb68-1dc5181bf2e8@linux.alibaba.com It's needed because once a syzbot complaint as below: https://lore.kernel.org/r/CAD-N9QXNx=p3-QoWzk6pCznF32CZy8kM3vvo8mamfZZ9CpUKdw@mail.gmail.com I'd suggest including the previous backgrounds at least in the newer patchset, otherwise it makes me explain again and again... Thanks, Gao Xiang > > Meta-comment, we need to come up with a "filesystem kobject type" to get > rid of lots of the boilerplate filesystem kobject logic as it's > duplicated in every filesystem in tiny different ways and lots of times > (like here), it's wrong. > > kobjects were not designed to be "used raw" like this, ideally they > would be wrapped in a subsystem that makes them easier to be used (like > the driver model), but filesystems decided to use them and that usage > just grew over the years. That's evolution for you...> > thanks, > > greg k-h