Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b53dc88 authored by Kinglong Mee's avatar Kinglong Mee Committed by Trond Myklebust
Browse files

NFS: Avoid infinite loop when RELEASE_LOCKOWNER getting expired error



Fix Commit 60ea6812 (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: default avatarKinglong Mee <kinglongmee@gmail.com>
[Trond: replace call to nfs4_async_handle_error() with
 nfs4_schedule_lease_recovery()]
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 122a8cda
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -5942,8 +5942,10 @@ struct nfs_release_lockowner_data {
static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata)
static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata)
{
{
	struct nfs_release_lockowner_data *data = calldata;
	struct nfs_release_lockowner_data *data = calldata;
	nfs40_setup_sequence(data->server,
	struct nfs_server *server = data->server;
				&data->args.seq_args, &data->res.seq_res, task);
	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;
	data->timestamp = jiffies;
}
}


@@ -5960,6 +5962,8 @@ static void nfs4_release_lockowner_done(struct rpc_task *task, void *calldata)
		break;
		break;
	case -NFS4ERR_STALE_CLIENTID:
	case -NFS4ERR_STALE_CLIENTID:
	case -NFS4ERR_EXPIRED:
	case -NFS4ERR_EXPIRED:
		nfs4_schedule_lease_recovery(server->nfs_client);
		break;
	case -NFS4ERR_LEASE_MOVED:
	case -NFS4ERR_LEASE_MOVED:
	case -NFS4ERR_DELAY:
	case -NFS4ERR_DELAY:
		if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN)
		if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN)