Skip to contentSkip to conversation

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

PATCH In review Kinglong Mee 2 participants 3 messages Aug 3, 2014 – Aug 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Update clientid in RELEASE_LOCKOWNER RPC after re-register clientid

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
                ... ...
---
 fs/nfs/nfs4proc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +5 -2
index 285ad53..6c4e6c1 100644
@@ -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;
 }
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 35 lines · Kinglong Mee

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
                ... ...
---
 fs/nfs/nfs4proc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index 285ad53..6c4e6c1 100644
@@ -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;

fs/nfs/nfs4proc.c struct nfs_release_lockowner_data { · line 5844

Quoted 10 lines
fs/nfs/nfs4proc.c +5 -2
-       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

Signature · 5 lines
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
#2 lore raw

PATCH v2 1/1 NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error

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
                ... ...
---
 fs/nfs/nfs4proc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +6 -2
index 285ad53..75dcce29c 100644
@@ -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)
Signature · 1 line
1.9.3