public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: linux-nfs@vger.kernel.org, NeilBrown <neilb@suse.de>
Subject: [PATCH 2/2] NFS: support changing timeout and retransmit values with remount
Date: Fri, 11 Sep 2009 16:56:03 +1000	[thread overview]
Message-ID: <20090911065603.8193.19468.stgit@notabene.brown> (raw)
In-Reply-To: <20090911065428.8193.8170.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>

Changing either timeo or retrans in
  mount -o remount

will now work.  Requests that are currently pending will not
have their timeouts changed.  However once they do timeout, the
next timeout will be based on the new values.

Signed-off-by: NeilBrown <neilb@suse.de>
---

 fs/nfs/client.c   |    4 ++--
 fs/nfs/internal.h |    2 ++
 fs/nfs/super.c    |   12 ++++++++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 8d25ccb..056e0ce 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -551,8 +551,8 @@ int nfs4_check_client_ready(struct nfs_client *clp)
 /*
  * Initialise the timeout values for a connection
  */
-static void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
-				    unsigned int timeo, unsigned int retrans)
+void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
+			     unsigned int timeo, unsigned int retrans)
 {
 	to->to_initval = timeo * HZ / 10;
 	to->to_retries = retrans;
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 7dd90a6..8395a7a 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -123,6 +123,8 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *,
 					   struct nfs_fattr *);
 extern void nfs_mark_client_ready(struct nfs_client *clp, int state);
 extern int nfs4_check_client_ready(struct nfs_client *clp);
+extern void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
+				    unsigned int timeo, unsigned int retrans);
 #ifdef CONFIG_PROC_FS
 extern int __init nfs_fs_proc_init(void);
 extern void nfs_fs_proc_exit(void);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 76b28ca..b064895 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1846,17 +1846,16 @@ nfs_compare_remount_data(struct nfs_server *nfss,
 	 * to change.
 	 * Currently they are:
 	 *   flags: NFS_MOUNT_SOFT
+	 *   timeo and retrans
 	 */
 	if (((data->flags ^ nfss->flags) & ~(NFS_MOUNT_SOFT)) ||
 	    data->rsize != nfss->rsize ||
 	    data->wsize != nfss->wsize ||
-	    data->retrans != nfss->client->cl_timeout->to_retries ||
 	    data->auth_flavors[0] != nfss->client->cl_auth->au_flavor ||
 	    data->acregmin != nfss->acregmin / HZ ||
 	    data->acregmax != nfss->acregmax / HZ ||
 	    data->acdirmin != nfss->acdirmin / HZ ||
 	    data->acdirmax != nfss->acdirmax / HZ ||
-	    data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) ||
 	    data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen ||
 	    memcmp(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
 		   data->nfs_server.addrlen) != 0)
@@ -1933,6 +1932,15 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
 			nfss->flags &= ~NFS_MOUNT_SOFT;
 	}
 
+	if (data->retrans != nfss->client->cl_timeout->to_retries ||
+	    data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ)) {
+		struct rpc_timeout timeparms;
+		nfs_init_timeout_values(&timeparms, nfss->client->cl_xprt->prot,
+					data->timeo, data->retrans);
+		memcpy(&nfss->client->cl_timeout_default,
+		       &timeparms, sizeof(timeparms));
+		nfss->client->cl_timeout = &nfss->client->cl_timeout_default;
+	}
 out:
 	kfree(data);
 	unlock_kernel();



      parent reply	other threads:[~2009-09-11  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11  6:56 [PATCH 0/2] NFS: allow remount to change some parameters NeilBrown
     [not found] ` <20090911065428.8193.8170.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2009-09-11  6:56   ` [PATCH 1/2] NFS: support changing the soft/hard flag with remount NeilBrown
2009-09-11  6:56   ` NeilBrown [this message]

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=20090911065603.8193.19468.stgit@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /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