[RFC 17/85] nfs41: fallback to lower minorversion if nfs4_create_server fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



retry nfs4_create_server with lower minorversion on minorvers_mismatch error

Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx>
---
 fs/nfs/client.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 11c845d..0a8a082 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1118,15 +1118,17 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
 {
 	struct nfs_fattr fattr;
 	struct nfs_server *server;
+	int minorvers = data->minorversion;
 	int error;
 
 	dprintk("--> nfs4_create_server()\n");
 
+retry:
 	server = nfs_alloc_server();
 	if (!server)
 		return ERR_PTR(-ENOMEM);
 
-	server->minorversion = data->minorversion;
+	server->minorversion = minorvers;
 
 	/* set up the general RPC client */
 	error = nfs4_init_server(server, data);
@@ -1168,7 +1170,15 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
 	return server;
 
 error:
+	if (server->nfs_client && server->nfs_client->cl_recovery_status)
+		error = server->nfs_client->cl_recovery_status;
 	nfs_free_server(server);
+	if (minorvers > 0 && error == -NFS4ERR_MINOR_VERS_MISMATCH) {
+		minorvers--;
+		dprintk("%s: error %d retrying with minorvers=%d\n",
+			__func__, error, minorvers);
+		goto retry;
+	}
 	dprintk("<-- nfs4_create_server() = error %d\n", error);
 	return ERR_PTR(error);
 }
-- 
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux