mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Chiluk <chiluk@canonical.com>
To: Trond.Myklebust@netapp.com, bfields@fieldses.org,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] NFSv4: Use exponential backoff delay for NFS4_ERRDELAY
Date: Wed, 24 Apr 2013 15:55:49 -0500	[thread overview]
Message-ID: <1366836949-18465-1-git-send-email-chiluk@canonical.com> (raw)

Changing the retry to start at NFS4_POLL_RETRY_MIN and exponentially grow
to NFS4_POLL_RETRY_MAX allow for faster handling of these error conditions.

Additionally this alleviates an interoperability problem with the AIX NFSv4
Server.  The AIX server frequently (2 out of 3) returns NFS4ERR_DELAY, on a
close when it happens in close proximity to a RELEASE_LOCKOWNER.  This would
cause a linux client to hang for 15 seconds.

Signed-off-by: Dave Chiluk <chiluk@canonical.com>
---
 fs/nfs/nfs4proc.c            |   12 ++++++++++++
 include/linux/sunrpc/sched.h |    1 +
 2 files changed, 13 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ad025e..37dad27 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4006,6 +4006,18 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server,
 #endif /* CONFIG_NFS_V4_1 */
 		case -NFS4ERR_DELAY:
 			nfs_inc_server_stats(server, NFSIOS_DELAY);
+			/* Do an exponential backoff of retries from
+			 * NFS4_POLL_RETRY_MIN to NFS4_POLL_RETRY_MAX. */
+			task->tk_timeout = NFS4_POLL_RETRY_MIN <<
+					(task->tk_delays*2);
+			if (task->tk_timeout > NFS4_POLL_RETRY_MAX)
+				rpc_delay(task, NFS4_POLL_RETRY_MAX);
+			else {
+				task->tk_delays++;
+				rpc_delay(task, task->tk_timeout);
+			}
+			task->tk_status = 0;
+			return -EAGAIN;
 		case -NFS4ERR_GRACE:
 			rpc_delay(task, NFS4_POLL_RETRY_MAX);
 			task->tk_status = 0;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 84ca436..60f82bf 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -62,6 +62,7 @@ struct rpc_task {
 	void *			tk_calldata;
 
 	unsigned long		tk_timeout;	/* timeout for rpc_sleep() */
+	unsigned short		tk_delays;	/* number of times task delayed */
 	unsigned long		tk_runstate;	/* Task run status */
 	struct workqueue_struct	*tk_workqueue;	/* Normally rpciod, but could
 						 * be any workqueue
-- 
1.7.9.5


             reply	other threads:[~2013-04-24 20:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 20:55 Dave Chiluk [this message]
2013-04-24 21:11 ` J. Bruce Fields
2013-04-24 21:28 ` Myklebust, Trond
2013-04-24 21:54   ` Dave Chiluk
2013-04-24 22:35     ` Myklebust, Trond
2013-04-25 12:19       ` David Wysochanski
2013-04-25 13:19         ` Myklebust, Trond
2013-04-25 13:29         ` bfields
2013-04-25 13:30           ` Myklebust, Trond
2013-04-25 13:49             ` bfields
2013-04-25 14:10               ` Myklebust, Trond
2013-04-25 15:28                 ` [PATCH] NFSv4: Use exponential backoff delay for Ni Matt W. Benjamin
2013-04-25 15:42                   ` Myklebust, Trond
2013-04-25 18:19                 ` [PATCH] NFSv4: Use exponential backoff delay for NFS4_ERRDELAY bfields
2013-04-25 18:40                   ` Chuck Lever
2013-04-25 18:46                     ` bfields
2013-04-25 18:51                       ` Chuck Lever
2013-04-25 18:57                         ` bfields
2013-04-25 18:52                       ` Myklebust, Trond
2013-04-25 14:51               ` Chuck Lever

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=1366836949-18465-1-git-send-email-chiluk@canonical.com \
    --to=chiluk@canonical.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@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®