Skip to contentSkip to conversation

NFS: don't let nfs_callback_svc exit on unexpected svc_recv errors

PATCH New Jeff Layton 1 participant 2 messages Apr 8, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: don't let nfs_callback_svc exit on unexpected svc_recv errors

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.

---
 fs/nfs/callback.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/nfs/callback.c +5 -4
index a9f1538..78bc69a 100644
@@ -77,10 +77,11 @@ nfs_callback_svc(void *vrqstp)
 		if (err == -EAGAIN || err == -EINTR)
 			continue;
 		if (err < 0) {
-			printk(KERN_WARNING
-					"%s: terminating on error %d\n",
-					__FUNCTION__, -err);
-			break;
+			if (printk_ratelimit())
+				printk(KERN_WARNING "%s: unexpected error "
+					"from svc_recv (%d)\n", __func__, err);
+			schedule_timeout_uninterruptible(HZ);
+			continue;
 		}
 		svc_process(rqstp);
 	}
Signature · 1 line
1.5.3.6
#1 lore raw

PATCH 1/1 NLM: don't let lockd exit on unexpected svc_recv errors

When svc_recv returns an unexpected error, lockd 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 can lead to a potential BUG() call.

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.

---
 fs/lockd/svc.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
fs/lockd/svc.c +5 -4
index 66b5c98..147ae95 100644
@@ -175,10 +175,11 @@ lockd(void *vrqstp)
 		if (err == -EAGAIN || err == -EINTR)
 			continue;
 		if (err < 0) {
-			printk(KERN_WARNING
-			       "lockd: terminating on error %d\n",
-			       -err);
-			break;
+			if (printk_ratelimit())
+				printk(KERN_WARNING "%s: unexpected error "
+					"from svc_recv (%d)\n", __func__, err);
+			schedule_timeout_interruptible(HZ);
+			continue;
 		}
 
 		dprintk("lockd: request from %s\n",
Signature · 1 line
1.5.3.6