aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r--fs/nfs/callback.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index bd185a572a23..66648dd92d97 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -93,6 +93,7 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
93 svc_process(rqstp); 93 svc_process(rqstp);
94 } 94 }
95 95
96 flush_signals(current);
96 svc_exit_thread(rqstp); 97 svc_exit_thread(rqstp);
97 nfs_callback_info.pid = 0; 98 nfs_callback_info.pid = 0;
98 complete(&nfs_callback_info.stopped); 99 complete(&nfs_callback_info.stopped);
@@ -105,7 +106,7 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
105 */ 106 */
106int nfs_callback_up(void) 107int nfs_callback_up(void)
107{ 108{
108 struct svc_serv *serv; 109 struct svc_serv *serv = NULL;
109 int ret = 0; 110 int ret = 0;
110 111
111 lock_kernel(); 112 lock_kernel();
@@ -122,24 +123,30 @@ int nfs_callback_up(void)
122 ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport, 123 ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport,
123 SVC_SOCK_ANONYMOUS); 124 SVC_SOCK_ANONYMOUS);
124 if (ret <= 0) 125 if (ret <= 0)
125 goto out_destroy; 126 goto out_err;
126 nfs_callback_tcpport = ret; 127 nfs_callback_tcpport = ret;
127 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); 128 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);
128 129
129 ret = svc_create_thread(nfs_callback_svc, serv); 130 ret = svc_create_thread(nfs_callback_svc, serv);
130 if (ret < 0) 131 if (ret < 0)
131 goto out_destroy; 132 goto out_err;
132 nfs_callback_info.serv = serv; 133 nfs_callback_info.serv = serv;
133 wait_for_completion(&nfs_callback_info.started); 134 wait_for_completion(&nfs_callback_info.started);
134out: 135out:
136 /*
137 * svc_create creates the svc_serv with sv_nrthreads == 1, and then
138 * svc_create_thread increments that. So we need to call svc_destroy
139 * on both success and failure so that the refcount is 1 when the
140 * thread exits.
141 */
142 if (serv)
143 svc_destroy(serv);
135 mutex_unlock(&nfs_callback_mutex); 144 mutex_unlock(&nfs_callback_mutex);
136 unlock_kernel(); 145 unlock_kernel();
137 return ret; 146 return ret;
138out_destroy: 147out_err:
139 dprintk("Couldn't create callback socket or server thread; err = %d\n", 148 dprintk("Couldn't create callback socket or server thread; err = %d\n",
140 ret); 149 ret);
141 svc_destroy(serv);
142out_err:
143 nfs_callback_info.users--; 150 nfs_callback_info.users--;
144 goto out; 151 goto out;
145} 152}
@@ -165,7 +172,7 @@ void nfs_callback_down(void)
165static int nfs_callback_authenticate(struct svc_rqst *rqstp) 172static int nfs_callback_authenticate(struct svc_rqst *rqstp)
166{ 173{
167 struct nfs_client *clp; 174 struct nfs_client *clp;
168 char buf[RPC_MAX_ADDRBUFLEN]; 175 RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
169 176
170 /* Don't talk to strangers */ 177 /* Don't talk to strangers */
171 clp = nfs_find_client(svc_addr(rqstp), 4); 178 clp = nfs_find_client(svc_addr(rqstp), 4);