linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernelNFS(lockd) problem and patch suggestion
@ 2002-10-07 22:26 Juan Gomez
  2002-10-07 23:51 ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Juan Gomez @ 2002-10-07 22:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: juang

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]





Hi all,

I noticed that after starting a linux NFS server, the first lock request
gets delayed about 30 seconds even after waiting the 45 seconds
corresponding to the grace period.
At first I thought this was due to the fact that being the first time a
lock is acquired through the server lockd/statd interaction was required
and the creation of a new file was involved
(i.e. statd/sm/client_IP) but still 30 seconds was way too long...

After taking a look at the code I realized that the lockd thread sets grace
period and then goes to sleep for a long time waiting for messages and the
first message always gets processed
before checking if the grace period has completed (which it might after
sleeping for a long time).

I think this can be easily fixed by clearing the grace period after waiting
for messages and before procesing them for correct operation as described
in the following patch.

I will appreciate if this patch can be considered for inclusion in the
general distribution of the kernel.

(See attached file: lockd_delay_patch.2.4.19)


Juan

[-- Attachment #2: lockd_delay_patch.2.4.19 --]
[-- Type: application/octet-stream, Size: 1398 bytes --]

*** linux-2.4.19/fs/lockd/svc.c	Sun Oct 21 10:32:33 2001
--- linux-2.4.19.lockd_delay_patch/fs/lockd/svc.c	Mon Oct  7 22:16:20 2002
***************
*** 144,151 ****
  		 */
  		if (!nlmsvc_grace_period) {
  			timeout = nlmsvc_retry_blocked();
! 		} else if (time_before(grace_period_expire, jiffies))
! 			clear_grace_period();
  
  		/*
  		 * Find a socket with data available and call its
--- 144,150 ----
  		 */
  		if (!nlmsvc_grace_period) {
  			timeout = nlmsvc_retry_blocked();
! 		} 
  
  		/*
  		 * Find a socket with data available and call its
***************
*** 163,168 ****
--- 162,177 ----
  
  		dprintk("lockd: request from %08x\n",
  			(unsigned)ntohl(rqstp->rq_addr.sin_addr.s_addr));
+ 
+                 /* We need to do the clear/grace period here and not before svc_recv()
+                  * because svc_recv may sleep longer than the grace period and the 
+                  * first request may be falsely processed as if the server was in the 
+                  * grace period when it is not causing unnecessary delays.
+                  * Juan C. Gomez j_carlos_gome@yahoo.com
+                  */
+                 if (nlmsvc_grace_period && time_before(grace_period_expire, jiffies)){
+                   clear_grace_period();
+                 }
  
  		/*
  		 * Look up the NFS client handle. The handle is needed for

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kernelNFS(lockd) problem and patch suggestion
  2002-10-07 22:26 kernelNFS(lockd) problem and patch suggestion Juan Gomez
@ 2002-10-07 23:51 ` Trond Myklebust
  0 siblings, 0 replies; 3+ messages in thread
From: Trond Myklebust @ 2002-10-07 23:51 UTC (permalink / raw)
  To: Juan Gomez; +Cc: linux-kernel

>>>>> " " == Juan Gomez <juang@us.ibm.com> writes:

     > After taking a look at the code I realized that the lockd
     > thread sets grace period and then goes to sleep for a long time
     > waiting for messages and the first message always gets
     > processed before checking if the grace period has completed

Please could you rediff using the '-u' option and drop the MIME
attachment thingy (See Documentation/SubmittingPatches).

Patch otherwise looks quite correct, so once the patch format is OK
then, by all means send it off to Marcelo and (if you could bang up
the same patch for 2.5.x) to Linus too.

Cheers,
  Trond

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kernelNFS(lockd) problem and patch suggestion
@ 2002-10-08  0:00 Juan Gomez
  0 siblings, 0 replies; 3+ messages in thread
From: Juan Gomez @ 2002-10-08  0:00 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel

                                                                                                               
                                                                                                               
                                                                                                               


OK I will do so...hopefully "Marcelo" is reading these postings as I do not
have his direct email.

Regards, Juan



|---------+---------------------------->
|         |           Trond Myklebust  |
|         |           <trond.myklebust@|
|         |           fys.uio.no>      |
|         |                            |
|         |           10/07/02 04:51 PM|
|         |                            |
|---------+---------------------------->
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |       To:       Juan Gomez/Almaden/IBM@IBMUS                                                                                 |
  |       cc:       linux-kernel@vger.kernel.org                                                                                 |
  |       Subject:  Re: kernelNFS(lockd) problem and patch suggestion                                                            |
  |                                                                                                                              |
  |                                                                                                                              |
  >------------------------------------------------------------------------------------------------------------------------------|



>>>>> " " == Juan Gomez <juang@us.ibm.com> writes:

     > After taking a look at the code I realized that the lockd
     > thread sets grace period and then goes to sleep for a long time
     > waiting for messages and the first message always gets
     > processed before checking if the grace period has completed

Please could you rediff using the '-u' option and drop the MIME
attachment thingy (See Documentation/SubmittingPatches).

Patch otherwise looks quite correct, so once the patch format is OK
then, by all means send it off to Marcelo and (if you could bang up
the same patch for 2.5.x) to Linus too.

Cheers,
  Trond




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-07 23:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 22:26 kernelNFS(lockd) problem and patch suggestion Juan Gomez
2002-10-07 23:51 ` Trond Myklebust
2002-10-08  0:00 Juan Gomez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).