diff mbox

NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid

Message ID 53DE56C7.2080407@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kinglong Mee Aug. 3, 2014, 3:35 p.m. UTC
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(-)

Comments

Trond Myklebust Aug. 3, 2014, 3:39 p.m. UTC | #1
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
diff mbox

Patch

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;
 }