From: Stanislav Kinsbursky <skinsbursky@parallels.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, xemul@parallels.com, neilb@suse.de,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
jbottomley@parallels.com, bfields@fieldses.org,
davem@davemloft.net, devel@openvz.org
Subject: [PATCH v2 2/4] NFS: release per-net clients lock before calling PipeFS dentries creation
Date: Mon, 27 Feb 2012 19:51:04 +0400 [thread overview]
Message-ID: <20120227155103.7941.17006.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20120227154713.7941.17963.stgit@localhost6.localdomain6>
Lockdep is sad otherwise, because inode mutex is taken on PipeFS dentry
creation, which can be called on mount notification, where this per-net client
lock is taken on clients list walk.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
---
fs/nfs/client.c | 2 +-
fs/nfs/idmap.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 8563585..6aeb6b3 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -538,7 +538,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
/* install a new client and return with it unready */
install_client:
clp = new;
- list_add(&clp->cl_share_link, &nn->nfs_client_list);
+ list_add_tail(&clp->cl_share_link, &nn->nfs_client_list);
spin_unlock(&nn->nfs_client_lock);
error = cl_init->rpc_ops->init_client(clp, timeparms, ip_addr,
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index b5c6d8e..8a9e7a4 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -558,16 +558,20 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
{
struct super_block *sb = ptr;
struct nfs_net *nn = net_generic(sb->s_fs_info, nfs_net_id);
- struct nfs_client *clp;
+ struct nfs_client *clp, *tmp;
int error = 0;
spin_lock(&nn->nfs_client_lock);
- list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
+ list_for_each_entry_safe(clp, tmp, &nn->nfs_client_list, cl_share_link) {
if (clp->rpc_ops != &nfs_v4_clientops)
continue;
+ atomic_inc(&clp->cl_count);
+ spin_unlock(&nn->nfs_client_lock);
error = __rpc_pipefs_event(clp, event, sb);
+ nfs_put_client(clp);
if (error)
break;
+ spin_lock(&nn->nfs_client_lock);
}
spin_unlock(&nn->nfs_client_lock);
return error;
next prev parent reply other threads:[~2012-02-27 15:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 15:50 [PATCH v2 0/4] SUNRPC: several fixes around PipeFS objects Stanislav Kinsbursky
2012-02-27 15:50 ` [PATCH v2 1/4] SUNRPC: release per-net clients lock before calling PipeFS dentries creation Stanislav Kinsbursky
2012-02-27 16:21 ` Myklebust, Trond
2012-02-27 16:55 ` Stanislav Kinsbursky
2012-02-27 17:11 ` David Laight
2012-02-27 17:37 ` Myklebust, Trond
2012-02-27 15:51 ` Stanislav Kinsbursky [this message]
[not found] ` <20120227155103.7941.17006.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2012-02-27 15:59 ` [PATCH v2 2/4] NFS: " David Laight
2012-02-27 16:20 ` Stanislav Kinsbursky
2012-02-27 15:51 ` [PATCH v2 3/4] SUNRPC: check RPC inode's pipe reference before dereferencing Stanislav Kinsbursky
[not found] ` <20120227154713.7941.17963.stgit-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2012-02-27 15:51 ` [PATCH v2 4/4] SUNRPC: move waitq from RPC pipe to RPC inode Stanislav Kinsbursky
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=20120227155103.7941.17006.stgit@localhost6.localdomain6 \
--to=skinsbursky@parallels.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=jbottomley@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=xemul@parallels.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).