Commit 06e02d66 authored by Jeff Layton's avatar Jeff Layton Committed by J. Bruce Fields

NFS: don't let nfs_callback_svc exit on unexpected svc_recv errors (try #2)

When svc_recv returns an unexpected error, nfs_callback_svc will print a
warning and exit. This problematic for several reasons. In particular,
it will cause the reference counts for the thread to be wrong, and no
new thread will be started until all nfs4 mounts are unmounted.

Rather than exiting on error from svc_recv, have the thread do a 1s
sleep and then retry the loop. This is unlikely to cause any harm, and
if the error turns out to be something temporary then it may be able to
recover.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 9078dc08
...@@ -59,7 +59,7 @@ module_param_call(callback_tcpport, param_set_port, param_get_int, ...@@ -59,7 +59,7 @@ module_param_call(callback_tcpport, param_set_port, param_get_int,
static int static int
nfs_callback_svc(void *vrqstp) nfs_callback_svc(void *vrqstp)
{ {
int err; int err, preverr = 0;
struct svc_rqst *rqstp = vrqstp; struct svc_rqst *rqstp = vrqstp;
set_freezable(); set_freezable();
...@@ -74,14 +74,20 @@ nfs_callback_svc(void *vrqstp) ...@@ -74,14 +74,20 @@ nfs_callback_svc(void *vrqstp)
* Listen for a request on the socket * Listen for a request on the socket
*/ */
err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT); err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT);
if (err == -EAGAIN || err == -EINTR) if (err == -EAGAIN || err == -EINTR) {
preverr = err;
continue; continue;
}
if (err < 0) { if (err < 0) {
printk(KERN_WARNING if (err != preverr) {
"%s: terminating on error %d\n", printk(KERN_WARNING "%s: unexpected error "
__FUNCTION__, -err); "from svc_recv (%d)\n", __func__, err);
break; preverr = err;
}
schedule_timeout_uninterruptible(HZ);
continue;
} }
preverr = err;
svc_process(rqstp); svc_process(rqstp);
} }
unlock_kernel(); unlock_kernel();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment