mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juan Gomez <juang@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: juang@us.ibm.com
Subject: kernelNFS(lockd) problem and patch suggestion
Date: Mon, 7 Oct 2002 16:26:32 -0600	[thread overview]
Message-ID: <OF2F07E0DC.299628DE-ON87256C4B.00790F36@us.ibm.com> (raw)

[-- 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

             reply	other threads:[~2002-10-07 22:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07 22:26 Juan Gomez [this message]
2002-10-07 23:51 ` Trond Myklebust
2002-10-08  0:00 Juan Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF2F07E0DC.299628DE-ON87256C4B.00790F36@us.ibm.com \
    --to=juang@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®