From: Greg KH <gregkh@linuxfoundation.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Yangtao Li <frank.li@vivo.com>,
Naohiro Aota <naohiro.aota@wdc.com>,
Johannes Thumshirn <jth@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zonefs: remove unnecessary kobject_del()
Date: Wed, 12 Apr 2023 10:11:17 +0200 [thread overview]
Message-ID: <2023041238-stench-magnetism-0256@gregkh> (raw)
In-Reply-To: <9a92e541-cf98-4ac5-c181-4a6ba76d08f8@kernel.org>
On Wed, Apr 12, 2023 at 05:04:16PM +0900, Damien Le Moal wrote:
> 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 <frank.li@vivo.com>
> > ---
> > 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 ?
Yes, it's all a mess :(
See the other messatges in this thread:
https://lore.kernel.org/r/20230406120716.80980-1-frank.li@vivo.com
Please don't take this patch for now, this all needs to be revisited.
We have two reference counted objects with different lifespans trying to
be embedded in the same structure, causing a mess.
But, if we split them apart, that too has issues. I've been thinking
about how to resolve this, but don't have any solid ideas yet, and been
swamped with other things...
For now, let's just leave this all alone, it's not unique to this one
filesystem, they all have the same pattern, and we need to solve them
all properly at the same time by moving the common code into the driver
core so that filesystems don't have to worry about this mess.
thanks,
greg k-h
next prev parent reply other threads:[~2023-04-12 8:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 3:19 [PATCH] zonefs: remove unnecessary kobject_del() Yangtao Li
2023-04-12 8:04 ` Damien Le Moal
2023-04-12 8:11 ` Greg KH [this message]
2023-04-12 8:18 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023041238-stench-magnetism-0256@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dlemoal@kernel.org \
--cc=frank.li@vivo.com \
--cc=jth@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).