Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101939
b: refs/heads/master
c: 5afc597
h: refs/heads/master
i:
  101937: 459a088
  101935: 55b2bfd
v: v3
  • Loading branch information
Jeff Layton authored and Trond Myklebust committed Jul 9, 2008
1 parent 90565f5 commit 903b5cf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 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: ee84dfc45467fd8e5ce04fa2813d98e0aebe465c
refs/heads/master: 5afc597c5f0bd184457e49b9a330fcb37b69db11
30 changes: 16 additions & 14 deletions trunk/fs/nfs/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

struct nfs_callback_data {
unsigned int users;
struct svc_serv *serv;
struct svc_rqst *rqst;
struct task_struct *task;
};

Expand Down Expand Up @@ -91,18 +91,15 @@ nfs_callback_svc(void *vrqstp)
svc_process(rqstp);
}
unlock_kernel();
nfs_callback_info.task = NULL;
svc_exit_thread(rqstp);
return 0;
}

/*
* Bring up the server process if it is not already up.
* Bring up the callback thread if it is not already up.
*/
int nfs_callback_up(void)
{
struct svc_serv *serv = NULL;
struct svc_rqst *rqstp;
int ret = 0;

mutex_lock(&nfs_callback_mutex);
Expand All @@ -120,22 +117,23 @@ int nfs_callback_up(void)
nfs_callback_tcpport = ret;
dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);

rqstp = svc_prepare_thread(serv, &serv->sv_pools[0]);
if (IS_ERR(rqstp)) {
ret = PTR_ERR(rqstp);
nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]);
if (IS_ERR(nfs_callback_info.rqst)) {
ret = PTR_ERR(nfs_callback_info.rqst);
nfs_callback_info.rqst = NULL;
goto out_err;
}

svc_sock_update_bufs(serv);
nfs_callback_info.serv = serv;

nfs_callback_info.task = kthread_run(nfs_callback_svc, rqstp,
nfs_callback_info.task = kthread_run(nfs_callback_svc,
nfs_callback_info.rqst,
"nfsv4-svc");
if (IS_ERR(nfs_callback_info.task)) {
ret = PTR_ERR(nfs_callback_info.task);
nfs_callback_info.serv = NULL;
svc_exit_thread(nfs_callback_info.rqst);
nfs_callback_info.rqst = NULL;
nfs_callback_info.task = NULL;
svc_exit_thread(rqstp);
goto out_err;
}
out:
Expand All @@ -157,14 +155,18 @@ int nfs_callback_up(void)
}

/*
* Kill the server process if it is not already down.
* Kill the callback thread if it's no longer being used.
*/
void nfs_callback_down(void)
{
mutex_lock(&nfs_callback_mutex);
nfs_callback_info.users--;
if (nfs_callback_info.users == 0 && nfs_callback_info.task != NULL)
if (nfs_callback_info.users == 0 && nfs_callback_info.task != NULL) {
kthread_stop(nfs_callback_info.task);
svc_exit_thread(nfs_callback_info.rqst);
nfs_callback_info.rqst = NULL;
nfs_callback_info.task = NULL;
}
mutex_unlock(&nfs_callback_mutex);
}

Expand Down

0 comments on commit 903b5cf

Please sign in to comment.