Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309831
b: refs/heads/master
c: 2445223
h: refs/heads/master
i:
  309829: 67e42e6
  309827: 60327c3
  309823: 457727d
v: v3
  • Loading branch information
Stanislav Kinsbursky authored and J. Bruce Fields committed Jun 1, 2012
1 parent 6efe60f commit c0b3eb3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 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: dbf9b5d74ceae787607e3d7db626fffa8be3c03d
refs/heads/master: 24452239094a8b52f54fd4403f6e177837cecf67
38 changes: 27 additions & 11 deletions trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,21 +291,20 @@ static void lockd_down_net(struct svc_serv *serv, struct net *net)
}
}

/*
* Bring up the lockd process if it's not already up.
*/
int lockd_up(struct net *net)
static struct svc_serv *lockd_create_svc(void)
{
struct svc_serv *serv;
int error = 0;

mutex_lock(&nlmsvc_mutex);
/*
* Check whether we're already up and running.
*/
if (nlmsvc_rqst) {
error = lockd_up_net(nlmsvc_rqst->rq_server, net);
goto out;
/*
* Note: increase service usage, because later in case of error
* svc_destroy() will be called.
*/
svc_get(nlmsvc_rqst->rq_server);
return nlmsvc_rqst->rq_server;
}

/*
Expand All @@ -316,11 +315,28 @@ int lockd_up(struct net *net)
printk(KERN_WARNING
"lockd_up: no pid, %d users??\n", nlmsvc_users);

error = -ENOMEM;
serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL);
if (!serv) {
printk(KERN_WARNING "lockd_up: create service failed\n");
goto out;
return ERR_PTR(-ENOMEM);
}
return serv;
}

/*
* Bring up the lockd process if it's not already up.
*/
int lockd_up(struct net *net)
{
struct svc_serv *serv;
int error = 0;

mutex_lock(&nlmsvc_mutex);

serv = lockd_create_svc();
if (IS_ERR(serv)) {
error = PTR_ERR(serv);
goto err_create;
}

error = lockd_up_net(serv, net);
Expand Down Expand Up @@ -360,9 +376,9 @@ int lockd_up(struct net *net)
*/
err_net:
svc_destroy(serv);
out:
if (!error)
nlmsvc_users++;
err_create:
mutex_unlock(&nlmsvc_mutex);
return error;

Expand Down

0 comments on commit c0b3eb3

Please sign in to comment.