@@ -83,18 +83,18 @@ static void rpc_register_client(struct rpc_clnt *clnt)
{
struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id);
- spin_lock(&sn->rpc_client_lock);
+ down_write(&sn->rpc_client_lock);
list_add(&clnt->cl_clients, &sn->all_clients);
- spin_unlock(&sn->rpc_client_lock);
+ up_write(&sn->rpc_client_lock);
}
static void rpc_unregister_client(struct rpc_clnt *clnt)
{
struct sunrpc_net *sn = net_generic(clnt->cl_xprt->xprt_net, sunrpc_net_id);
- spin_lock(&sn->rpc_client_lock);
+ down_write(&sn->rpc_client_lock);
list_del(&clnt->cl_clients);
- spin_unlock(&sn->rpc_client_lock);
+ up_write(&sn->rpc_client_lock);
}
static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
@@ -212,13 +212,13 @@ static int rpc_pipefs_event(struct notifier_block *nb, unsigned long event,
int error = 0;
struct sunrpc_net *sn = net_generic(sb->s_fs_info, sunrpc_net_id);
- spin_lock(&sn->rpc_client_lock);
+ down_read(&sn->rpc_client_lock);
list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
error = __rpc_pipefs_event(clnt, event, sb);
if (error)
break;
}
- spin_unlock(&sn->rpc_client_lock);
+ up_read(&sn->rpc_client_lock);
return error;
}
@@ -1947,7 +1947,7 @@ void rpc_show_tasks(struct net *net)
int header = 0;
struct sunrpc_net *sn = net_generic(net, sunrpc_net_id);
- spin_lock(&sn->rpc_client_lock);
+ down_read(&sn->rpc_client_lock);
list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
spin_lock(&clnt->cl_lock);
list_for_each_entry(task, &clnt->cl_tasks, tk_task) {
@@ -1959,6 +1959,6 @@ void rpc_show_tasks(struct net *net)
}
spin_unlock(&clnt->cl_lock);
}
- spin_unlock(&sn->rpc_client_lock);
+ up_read(&sn->rpc_client_lock);
}
#endif
@@ -17,7 +17,7 @@ struct sunrpc_net {
struct mutex pipefs_sb_lock;
struct list_head all_clients;
- spinlock_t rpc_client_lock;
+ struct rw_semaphore rpc_client_lock;
struct rpc_clnt *rpcb_local_clnt;
struct rpc_clnt *rpcb_local_clnt4;
@@ -49,7 +49,7 @@ static __net_init int sunrpc_init_net(struct net *net)
rpc_pipefs_init_net(net);
INIT_LIST_HEAD(&sn->all_clients);
- spin_lock_init(&sn->rpc_client_lock);
+ init_rwsem(&sn->rpc_client_lock);
spin_lock_init(&sn->rpcb_clnt_lock);
return 0;
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> --- net/sunrpc/clnt.c | 16 ++++++++-------- net/sunrpc/netns.h | 2 +- net/sunrpc/sunrpc_syms.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html