svcrpc: remove handling of unknown errors from svc_recv
svc_recv() returns only -EINTR or -EAGAIN. If we really want to worry about the case where it has a bug that causes it to return something else, we could stick a WARN() in svc_recv. But it's silly to require every caller to have all this boilerplate to handle that case. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
9f9d2ebe69
commit
5b444cc9a4
|
@ -126,7 +126,7 @@ static void restart_grace(void)
|
||||||
static int
|
static int
|
||||||
lockd(void *vrqstp)
|
lockd(void *vrqstp)
|
||||||
{
|
{
|
||||||
int err = 0, preverr = 0;
|
int err = 0;
|
||||||
struct svc_rqst *rqstp = vrqstp;
|
struct svc_rqst *rqstp = vrqstp;
|
||||||
|
|
||||||
/* try_to_freeze() is called from svc_recv() */
|
/* try_to_freeze() is called from svc_recv() */
|
||||||
|
@ -165,21 +165,8 @@ lockd(void *vrqstp)
|
||||||
* recvfrom routine.
|
* recvfrom routine.
|
||||||
*/
|
*/
|
||||||
err = svc_recv(rqstp, timeout);
|
err = svc_recv(rqstp, timeout);
|
||||||
if (err == -EAGAIN || err == -EINTR) {
|
if (err == -EAGAIN || err == -EINTR)
|
||||||
preverr = err;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (err < 0) {
|
|
||||||
if (err != preverr) {
|
|
||||||
printk(KERN_WARNING "%s: unexpected error "
|
|
||||||
"from svc_recv (%d)\n", __func__, err);
|
|
||||||
preverr = err;
|
|
||||||
}
|
|
||||||
schedule_timeout_interruptible(HZ);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
preverr = err;
|
|
||||||
|
|
||||||
dprintk("lockd: request from %s\n",
|
dprintk("lockd: request from %s\n",
|
||||||
svc_print_addr(rqstp, buf, sizeof(buf)));
|
svc_print_addr(rqstp, buf, sizeof(buf)));
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ unsigned short nfs_callback_tcpport6;
|
||||||
static int
|
static int
|
||||||
nfs4_callback_svc(void *vrqstp)
|
nfs4_callback_svc(void *vrqstp)
|
||||||
{
|
{
|
||||||
int err, preverr = 0;
|
int err;
|
||||||
struct svc_rqst *rqstp = vrqstp;
|
struct svc_rqst *rqstp = vrqstp;
|
||||||
|
|
||||||
set_freezable();
|
set_freezable();
|
||||||
|
@ -55,20 +55,8 @@ nfs4_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 != preverr) {
|
|
||||||
printk(KERN_WARNING "NFS: %s: unexpected error "
|
|
||||||
"from svc_recv (%d)\n", __func__, err);
|
|
||||||
preverr = err;
|
|
||||||
}
|
|
||||||
schedule_timeout_uninterruptible(HZ);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
preverr = err;
|
|
||||||
svc_process(rqstp);
|
svc_process(rqstp);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -487,7 +487,7 @@ static int
|
||||||
nfsd(void *vrqstp)
|
nfsd(void *vrqstp)
|
||||||
{
|
{
|
||||||
struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp;
|
struct svc_rqst *rqstp = (struct svc_rqst *) vrqstp;
|
||||||
int err, preverr = 0;
|
int err;
|
||||||
|
|
||||||
/* Lock module and set up kernel thread */
|
/* Lock module and set up kernel thread */
|
||||||
mutex_lock(&nfsd_mutex);
|
mutex_lock(&nfsd_mutex);
|
||||||
|
@ -534,16 +534,6 @@ nfsd(void *vrqstp)
|
||||||
;
|
;
|
||||||
if (err == -EINTR)
|
if (err == -EINTR)
|
||||||
break;
|
break;
|
||||||
else if (err < 0) {
|
|
||||||
if (err != preverr) {
|
|
||||||
printk(KERN_WARNING "%s: unexpected error "
|
|
||||||
"from svc_recv (%d)\n", __func__, -err);
|
|
||||||
preverr = err;
|
|
||||||
}
|
|
||||||
schedule_timeout_uninterruptible(HZ);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_process_creds();
|
validate_process_creds();
|
||||||
svc_process(rqstp);
|
svc_process(rqstp);
|
||||||
validate_process_creds();
|
validate_process_creds();
|
||||||
|
|
Loading…
Reference in New Issue