[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJyZWtK4nihRkTME@slm.duckdns.org>
Date: Wed, 28 Jun 2023 10:34:34 -1000
From: Tejun Heo <tj@...nel.org>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Christian Brauner <brauner@...nel.org>, peterz@...radead.org,
lujialin4@...wei.com, lizefan.x@...edance.com, hannes@...xchg.org,
mingo@...hat.com, ebiggers@...nel.org, oleg@...hat.com,
akpm@...ux-foundation.org, viro@...iv.linux.org.uk,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-fsdevel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH 1/2] kernfs: add kernfs_ops.free operation to free
resources tied to the file
Hello, Suren.
On Wed, Jun 28, 2023 at 01:12:23PM -0700, Suren Baghdasaryan wrote:
> AFAIU all other files that handle polling rely on f_op->release()
> being called after all the users are gone, therefore they can safely
> free their resources. However kernfs can call ->release() while there
> are still active users of the file. I can't use that operation for
> resource cleanup therefore I was suggesting to add a new operation
> which would be called only after the last fput() and would guarantee
> no users. Again, I'm not an expert in this, so there might be a better
> way to handle it. Please advise.
So, w/ kernfs, the right thing to do is making sure that whatever is exposed
to the kernfs user is terminated on removal - ie. after kernfs_ops->release
is called, the ops table should be considered dead and there shouldn't be
anything left to clean up from the kernfs user side. You can add abstraction
kernfs so that kernfs can terminate the calls coming down from the higher
layers on its own. That's how every other operation is handled and what
should happen with the psi polling too.
Thanks.
--
tejun
Powered by blists - more mailing lists