Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp606243rwl; Wed, 12 Apr 2023 01:11:35 -0700 (PDT) X-Google-Smtp-Source: AKy350bI7MlIXLyxsvvsI8jeChbwmMbSHOWXuevnnLxXsdY1Vg7mSKHHt96IrVXg/56FEgp4z51L X-Received: by 2002:aa7:9f9b:0:b0:626:dc8:b004 with SMTP id z27-20020aa79f9b000000b006260dc8b004mr17977162pfr.26.1681287095165; Wed, 12 Apr 2023 01:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681287095; cv=none; d=google.com; s=arc-20160816; b=QWk5YXt5v8tucC6rxGYSaqhN8nasNTvZca9o9w5L5Esx21r1i525mTnH2PziZP/7WZ hvfPiC1y/DC42v20c93PpQr4bzkL4Fv/KLu0BITzXWd6gkmURBcxTu1WhEzOI54+dphz BdQfXDe4rpvfBx6j886SGJwxDS+vq5F8qkKH4gBKMr6fbsmzLl4Q4gg0xrX+4R9Eik6b SXGXCyya0Un2Uie1LEcB+RDEvVmwnBmiE78UgHZWKOUiP5MCeAEXEcV+Nj8gH2MwbYnj oML3O6HCdU6RtffdneMnJyyjRcZnA3UtJb8NLkEeUQLoHsd8C1ww64H1DOgHVUJdID5w r23Q== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=PDfKlWk4ImGqzA6otU+AX42ksQbZtNwDsoQ7nBfQ+V4=; b=QnIP7IGKsNL8B6pyQtZbNA4JiclZDiY/MeAJmOeyM0iUtsIPyaoEshHSCpS1NHqgD9 PWoNKZIfqEA+2S3yTRH5Ce765cjEDiMzqFzW2N2zcJbqo1Moax34mbxIDARKUxjPGEt9 Av+CJodHfQgwIcOuTEaHF00muU+P6+Cz3PoNmywoFkm7WuUUbub1Hu8RHnSfRfoF/vnd DAsXzrFZYtL0c+Fa50qejcF1gh5cFHWqAPHkOt1z6LSyjI7QxG8rI3IzNHcjLupztJoC a59pF+uC8SNFoHcGpp2J+K1njvSG8p/IkujwQ4m+UEtNeTQ9Qye6v+NIv8I7jNwFTY8v ZDAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PQU6x5s4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020aa78f11000000b00622ae306420si717651pfr.279.2023.04.12.01.11.24; Wed, 12 Apr 2023 01:11:35 -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=@kernel.org header.s=k20201202 header.b=PQU6x5s4; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjDLIEX (ORCPT + 99 others); Wed, 12 Apr 2023 04:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjDLIEU (ORCPT ); Wed, 12 Apr 2023 04:04:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA4B4EE8; Wed, 12 Apr 2023 01:04:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7437C62F40; Wed, 12 Apr 2023 08:04:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D85F1C433D2; Wed, 12 Apr 2023 08:04:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681286658; bh=M4jm0qcEHwHN2rg4cpI8iL/HUSBE5oILgTN4CgEI91E=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=PQU6x5s4Rz7n21TaZgbEDSkM2Eo3fLV/ykDjS4alLCLmzcGLs0Hynv2HRltrKfQ6j +rS9dQFHZqDDhZDp3EcTZWedICmjan0GAKnRPAHbzqywfRC7mY1KReenOZEMnXqwZ6 GJ7WQswzCIhBKBX9mFPmXuL4TTFQ8cQMBT8bgqDTzntsjmr083r0Dpee4jbLPaK0RJ 0VHMpgpTa7dyf9Hl3P3cCtWOPa/+O+L8G05s2FJdFzAoqVeYgnYPZVUYTjQ+U1PCHm B12jlctvn4D7JZNmomMAzq0pz8eYCARUDgg8+bx348Sk/Rn1wgug+4YoNBrRvrHGq9 5eVGDLUBcHJmw== Message-ID: <9a92e541-cf98-4ac5-c181-4a6ba76d08f8@kernel.org> Date: Wed, 12 Apr 2023 17:04:16 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] zonefs: remove unnecessary kobject_del() Content-Language: en-US To: Yangtao Li , Naohiro Aota , Johannes Thumshirn , Greg KH Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230412031904.13739-1-frank.li@vivo.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20230412031904.13739-1-frank.li@vivo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 4/12/23 12:19, Yangtao Li wrote: > kobject_put() actually covers kobject removal automatically, which is > single stage removal. So kill kobject_del() directly. > > Signed-off-by: Yangtao Li > --- > fs/zonefs/sysfs.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c > index 8ccb65c2b419..a535bdea1097 100644 > --- a/fs/zonefs/sysfs.c > +++ b/fs/zonefs/sysfs.c > @@ -113,7 +113,6 @@ void zonefs_sysfs_unregister(struct super_block *sb) > if (!sbi || !sbi->s_sysfs_registered) > return; > > - kobject_del(&sbi->s_kobj); > kobject_put(&sbi->s_kobj); > wait_for_completion(&sbi->s_kobj_unregister); > } What I am not sure about here is that if CONFIG_DEBUG_KOBJECT_RELEASE is enabled, the kobj release is delayed, so the kobject will stay in sysfs potentially after the umount() returns. Not exactly nice as that potentially create races in user space... Not 100% sure though. Greg ? Any thoughts on this ?