Re: A lockd bug in linux 2.1.127

Andrea Arcangeli (andrea@e-mind.com)
Mon, 9 Nov 1998 23:40:08 +0100 (CET)


On Sun, 8 Nov 1998, Linus Torvalds wrote:

> if (!nlmsvc_grace_period) {
^^^^^^^^^^^^^^^^^^^^
>- timeout = nlmsvc_retry_blocked() - jiffies;
>+ timeout = nlmsvc_retry_blocked();
> } else if (nlmsvc_grace_period < jiffies)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> nlmsvc_grace_period = 0;
>

This should fix also the misuse of the jiffies wrap case where
nlmsvc_grace_period == 0 is a normal value. Patch against 2.1.127 clean.

Index: linux/fs/lockd/svc.c
diff -u linux/fs/lockd/svc.c:1.1.1.2 linux/fs/lockd/svc.c:1.1.1.1.14.4
--- linux/fs/lockd/svc.c:1.1.1.2 Wed Nov 4 13:08:14 1998
+++ linux/fs/lockd/svc.c Mon Nov 9 23:36:50 1998
@@ -64,6 +64,7 @@
{
struct svc_serv *serv = rqstp->rq_server;
int err = 0;
+ unsigned long grace_period_expire;

/* Lock module and set up kernel thread */
MOD_INC_USE_COUNT;
@@ -111,7 +112,7 @@
}
#endif

- nlmsvc_grace_period += jiffies;
+ grace_period_expire = nlmsvc_grace_period + jiffies;
nlmsvc_timeout = nlm_timeout * HZ;

/*
@@ -135,8 +136,8 @@
* during grace period).
*/
if (!nlmsvc_grace_period) {
- timeout = nlmsvc_retry_blocked() - jiffies;
- } else if (nlmsvc_grace_period < jiffies)
+ timeout = nlmsvc_retry_blocked();
+ } else if (time_before(grace_period_expire, jiffies))
nlmsvc_grace_period = 0;

/*
Index: linux/fs/lockd/svclock.c
diff -u linux/fs/lockd/svclock.c:1.1.1.1 linux/fs/lockd/svclock.c:1.1.1.1.14.1
--- linux/fs/lockd/svclock.c:1.1.1.1 Fri Oct 2 19:22:37 1998
+++ linux/fs/lockd/svclock.c Mon Nov 9 23:36:50 1998
@@ -615,6 +615,7 @@
}

if ((block = nlm_blocked) && block->b_when != NLM_NEVER)
- return block->b_when;
- return 0;
+ return (block->b_when - jiffies);
+
+ return MAX_SCHEDULE_TIMEOUT;
}

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/