linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid
@ 2014-08-03 15:35 Kinglong Mee
  2014-08-03 15:39 ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Kinglong Mee @ 2014-08-03 15:35 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Chuck Lever, Linux NFS Mailing List, kinglongmee

Fix Commit 60ea681299 (NFS: Migration support for RELEASE_LOCKOWNER)
If getting expired error, client will enter a infinite loop as,

client                            server
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(old clid)             ----->
                <--- expired error
   SETCLIENTID                 ----->
                <--- a new clid
   SETCLIENTID_CONFIRM (new clid) -->
                <--- ok
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(new clid)             ----->
                <-- ok
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(new clid)             ----->
                <-- ok
                ... ...

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/nfs4proc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 285ad53..6c4e6c1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5834,8 +5834,11 @@ struct nfs_release_lockowner_data {
 static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata)
 {
 	struct nfs_release_lockowner_data *data = calldata;
-	nfs40_setup_sequence(data->server,
-				&data->args.seq_args, &data->res.seq_res, task);
+	struct nfs_server *server = data->server;
+
+	nfs40_setup_sequence(server, &data->args.seq_args,
+				 &data->res.seq_res, task);
+	data->args.lock_owner.clientid = server->nfs_client->cl_clientid;
 	data->timestamp = jiffies;
 }
 
-- 
1.9.3


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

* Re: [PATCH] NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid
  2014-08-03 15:35 [PATCH] NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid Kinglong Mee
@ 2014-08-03 15:39 ` Trond Myklebust
  2014-08-04  8:18   ` [PATCH v2] NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error Kinglong Mee
  0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2014-08-03 15:39 UTC (permalink / raw)
  To: Kinglong Mee; +Cc: Chuck Lever, Linux NFS Mailing List

On Sun, Aug 3, 2014 at 11:35 AM, Kinglong Mee <kinglongmee@gmail.com> wrote:
> Fix Commit 60ea681299 (NFS: Migration support for RELEASE_LOCKOWNER)
> If getting expired error, client will enter a infinite loop as,
>
> client                            server
>    RELEASE_LOCKOWNER(old clid) ----->
>                 <--- expired error
>    RENEW(old clid)             ----->
>                 <--- expired error
>    SETCLIENTID                 ----->
>                 <--- a new clid
>    SETCLIENTID_CONFIRM (new clid) -->
>                 <--- ok
>    RELEASE_LOCKOWNER(old clid) ----->
>                 <--- expired error
>    RENEW(new clid)             ----->
>                 <-- ok
>    RELEASE_LOCKOWNER(old clid) ----->
>                 <--- expired error
>    RENEW(new clid)             ----->
>                 <-- ok
>                 ... ...
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfs/nfs4proc.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 285ad53..6c4e6c1 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5834,8 +5834,11 @@ struct nfs_release_lockowner_data {
>  static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata)
>  {
>         struct nfs_release_lockowner_data *data = calldata;
> -       nfs40_setup_sequence(data->server,
> -                               &data->args.seq_args, &data->res.seq_res, task);
> +       struct nfs_server *server = data->server;
> +
> +       nfs40_setup_sequence(server, &data->args.seq_args,
> +                                &data->res.seq_res, task);
> +       data->args.lock_owner.clientid = server->nfs_client->cl_clientid;
>         data->timestamp = jiffies;
>  }
>

Hi Kinglong,

If the lease expired, the server will also have forgotten about our
lockowner, and so we shouldn't need to re-send the release_lockowner.

Cheers
  Trond


-- 
Trond Myklebust

Linux NFS client maintainer, PrimaryData

trond.myklebust@primarydata.com

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

* [PATCH v2] NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error
  2014-08-03 15:39 ` Trond Myklebust
@ 2014-08-04  8:18   ` Kinglong Mee
  0 siblings, 0 replies; 3+ messages in thread
From: Kinglong Mee @ 2014-08-04  8:18 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Chuck Lever, Linux NFS Mailing List

Fix Commit 60ea681299 (NFS: Migration support for RELEASE_LOCKOWNER)
If getting expired error, client will enter a infinite loop as,

client                            server
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(old clid)             ----->
                <--- expired error
   SETCLIENTID                 ----->
                <--- a new clid
   SETCLIENTID_CONFIRM (new clid) -->
                <--- ok
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(new clid)             ----->
                <-- ok
   RELEASE_LOCKOWNER(old clid) ----->
                <--- expired error
   RENEW(new clid)             ----->
                <-- ok
                ... ...

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 fs/nfs/nfs4proc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 285ad53..75dcce29c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5834,8 +5834,10 @@ struct nfs_release_lockowner_data {
 static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata)
 {
 	struct nfs_release_lockowner_data *data = calldata;
-	nfs40_setup_sequence(data->server,
-				&data->args.seq_args, &data->res.seq_res, task);
+	struct nfs_server *server = data->server;
+	nfs40_setup_sequence(server, &data->args.seq_args,
+				&data->res.seq_res, task);
+	data->args.lock_owner.clientid = server->nfs_client->cl_clientid;
 	data->timestamp = jiffies;
 }
 
@@ -5852,6 +5854,8 @@ static void nfs4_release_lockowner_done(struct rpc_task *task, void *calldata)
 		break;
 	case -NFS4ERR_STALE_CLIENTID:
 	case -NFS4ERR_EXPIRED:
+		nfs4_async_handle_error(task, server, NULL);
+		break;
 	case -NFS4ERR_LEASE_MOVED:
 	case -NFS4ERR_DELAY:
 		if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN)
-- 
1.9.3



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

end of thread, other threads:[~2014-08-04  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-03 15:35 [PATCH] NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid Kinglong Mee
2014-08-03 15:39 ` Trond Myklebust
2014-08-04  8:18   ` [PATCH v2] NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error Kinglong Mee

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).