[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190502030406.GT23075@ZenIV.linux.org.uk>
Date: Thu, 2 May 2019 04:04:06 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Wenbin Zeng <wenbin.zeng@...il.com>
Cc: davem@...emloft.net, bfields@...ldses.org, jlayton@...nel.org,
trond.myklebust@...merspace.com, anna.schumaker@...app.com,
wenbinzeng@...cent.com, dsahern@...il.com,
nicolas.dichtel@...nd.com, willy@...radead.org,
edumazet@...gle.com, jakub.kicinski@...ronome.com,
tyhicks@...onical.com, chuck.lever@...cle.com, neilb@...e.com,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-nfs@...r.kernel.org
Subject: Re: [PATCH 1/3] nsfs: add evict callback into struct
proc_ns_operations
On Wed, May 01, 2019 at 02:42:23PM +0800, Wenbin Zeng wrote:
> The newly added evict callback shall be called by nsfs_evict(). Currently
> only put() callback is called in nsfs_evict(), it is not able to release
> all netns refcount, for example, a rpc client holds two netns refcounts,
> these refcounts are supposed to be released when the rpc client is freed,
> but the code to free rpc client is normally triggered by put() callback
> only when netns refcount gets to 0, specifically:
> refcount=0 -> cleanup_net() -> ops_exit_list -> free rpc client
> But netns refcount will never get to 0 before rpc client gets freed, to
> break the deadlock, the code to free rpc client can be put into the newly
> added evict callback.
>
> Signed-off-by: Wenbin Zeng <wenbinzeng@...cent.com>
> ---
> fs/nsfs.c | 2 ++
> include/linux/proc_ns.h | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/fs/nsfs.c b/fs/nsfs.c
> index 60702d6..5939b12 100644
> --- a/fs/nsfs.c
> +++ b/fs/nsfs.c
> @@ -49,6 +49,8 @@ static void nsfs_evict(struct inode *inode)
> struct ns_common *ns = inode->i_private;
> clear_inode(inode);
> ns->ops->put(ns);
> + if (ns->ops->evict)
> + ns->ops->evict(ns);
What's to guarantee that ns will not be freed by ->put()?
Confused...
Powered by blists - more mailing lists