From: Greg KH <gregkh@linuxfoundation.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: chao@kernel.org, damien.lemoal@opensource.wdc.com,
huyue2@coolpad.com, jefflexu@linux.alibaba.com, jth@kernel.org,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, naohiro.aota@wdc.com,
rafael@kernel.org, xiang@kernel.org
Subject: Re: [PATCH 2/3] erofs: convert to use kobject_is_added()
Date: Thu, 6 Apr 2023 16:31:24 +0200 [thread overview]
Message-ID: <2023040602-stack-overture-d418@gregkh> (raw)
In-Reply-To: <20230406120716.80980-1-frank.li@vivo.com>
On Thu, Apr 06, 2023 at 08:07:16PM +0800, Yangtao Li wrote:
> > 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.
>
> Can we add the following structure?
>
> struct filesystem_kobject {
> struct kobject kobject;
> struct completion unregister;
> };
Ah, no, I see the problem.
The filesystem authors are treating the kobject NOT as the thing that
handles the lifespan of the structure it is embedded in, but rather as
something else (i.e. a convient place to put filesystem information to
userspace.)
That isn't going to work, and as proof of that, the release callback
should be a simple call to kfree(), NOT as a completion notification
which then something else will go off and free the memory here. That
implies that there are multiple reference counting structures happening
on the same structure, which is not ok.
Either we let the kobject code properly handle the lifespan of the
structure, OR we pull it out of the structure and just let it hang off
as a separate structure (i.e. a pointer to something else.)
As the superblock lifespan rules ALREADY control the reference counting
logic of the filesystem superblock structure, let's stick with that and
just tack-on the kobject as a separate structure entirely.
Does that make sense? Let me do a quick pass at this for zonefs as
that's pretty simple to show you what I mean...
thanks,
greg k-h
next prev parent reply other threads:[~2023-04-06 14:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 9:30 [PATCH 1/3] kobject: introduce kobject_is_added() Yangtao Li
2023-04-06 9:30 ` [PATCH 2/3] erofs: convert to use kobject_is_added() Yangtao Li
2023-04-06 10:03 ` Greg KH
2023-04-06 10:13 ` Gao Xiang
2023-04-06 10:27 ` Greg KH
2023-04-06 10:55 ` Gao Xiang
2023-04-06 11:19 ` Greg KH
2023-04-06 12:07 ` Yangtao Li
2023-04-06 13:50 ` Yangtao Li
2023-04-06 14:31 ` Greg KH [this message]
2023-04-06 17:52 ` Yangtao Li
2023-04-07 6:09 ` Yangtao Li
2023-04-07 7:23 ` Yangtao Li
2023-04-06 9:30 ` [PATCH 3/3] zonefs: " Yangtao Li
2023-04-06 10:05 ` Greg KH
2023-04-06 10:13 ` Damien Le Moal
2023-04-06 10:26 ` Greg KH
2023-04-06 10:58 ` Damien Le Moal
2023-04-06 11:18 ` Greg KH
2023-04-06 11:23 ` Damien Le Moal
2023-04-06 9:59 ` [PATCH 1/3] kobject: introduce kobject_is_added() Greg KH
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=2023040602-stack-overture-d418@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=chao@kernel.org \
--cc=damien.lemoal@opensource.wdc.com \
--cc=frank.li@vivo.com \
--cc=huyue2@coolpad.com \
--cc=jefflexu@linux.alibaba.com \
--cc=jth@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=rafael@kernel.org \
--cc=xiang@kernel.org \
/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).