Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294471
b: refs/heads/master
c: bb2224d
h: refs/heads/master
i:
  294469: b5de362
  294467: 892bc79
  294463: 19990dd
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Feb 15, 2012
1 parent 0e726e5 commit 7f0c8b2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a9c5d73a8d8cb37601f8c39b35b9b4128e1a5254
refs/heads/master: bb2224df5ffe4f864f5b696199b17db1ce77bc0a
47 changes: 45 additions & 2 deletions trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,45 @@ static int make_socks(struct svc_serv *serv, struct net *net)
return err;
}

static int lockd_up_net(struct net *net)
{
struct lockd_net *ln = net_generic(net, lockd_net_id);
struct svc_serv *serv = nlmsvc_rqst->rq_server;
int error;

if (ln->nlmsvc_users)
return 0;

error = svc_rpcb_setup(serv, net);
if (error)
goto err_rpcb;

error = make_socks(serv, net);
if (error < 0)
goto err_socks;
return 0;

err_socks:
svc_rpcb_cleanup(serv, net);
err_rpcb:
return error;
}

static void lockd_down_net(struct net *net)
{
struct lockd_net *ln = net_generic(net, lockd_net_id);
struct svc_serv *serv = nlmsvc_rqst->rq_server;

if (ln->nlmsvc_users) {
if (--ln->nlmsvc_users == 0)
svc_shutdown_net(serv, net);
} else {
printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n",
nlmsvc_task, net);
BUG();
}
}

/*
* Bring up the lockd process if it's not already up.
*/
Expand All @@ -264,8 +303,10 @@ int lockd_up(void)
/*
* Check whether we're already up and running.
*/
if (nlmsvc_rqst)
if (nlmsvc_rqst) {
error = lockd_up_net(net);
goto out;
}

/*
* Sanity check: if there's no pid,
Expand Down Expand Up @@ -339,8 +380,10 @@ lockd_down(void)
{
mutex_lock(&nlmsvc_mutex);
if (nlmsvc_users) {
if (--nlmsvc_users)
if (--nlmsvc_users) {
lockd_down_net(current->nsproxy->net_ns);
goto out;
}
} else {
printk(KERN_ERR "lockd_down: no users! task=%p\n",
nlmsvc_task);
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ struct svc_procedure {
/*
* Function prototypes.
*/
int svc_rpcb_setup(struct svc_serv *serv, struct net *net);
void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net);
struct svc_serv *svc_create(struct svc_program *, unsigned int,
void (*shutdown)(struct svc_serv *, struct net *net));
Expand All @@ -426,6 +427,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
void svc_destroy(struct svc_serv *);
void svc_shutdown_net(struct svc_serv *, struct net *);
int svc_process(struct svc_rqst *);
int bc_svc_process(struct svc_serv *, struct rpc_rqst *,
struct svc_rqst *);
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/sunrpc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu)
return &serv->sv_pools[pidx % serv->sv_nrpools];
}

static int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
{
int err;

Expand All @@ -381,6 +381,7 @@ static int svc_rpcb_setup(struct svc_serv *serv, struct net *net)
svc_unregister(serv, net);
return 0;
}
EXPORT_SYMBOL_GPL(svc_rpcb_setup);

void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net)
{
Expand Down

0 comments on commit 7f0c8b2

Please sign in to comment.