[pnfs] [PATCH 2/2] nfs41: fix hardcoding of minorversion

sager at netapp.com sager at netapp.com
Tue Apr 29 22:43:27 EDT 2008


From: Mike Sager <sager at netapp.com>

During client initialization, if CONFIG_NFS_V4_1 is defined, 4.1 is
assumed.  Fix this to use the specified (or default) minorversion.

Signed-off-by: Mike Sager <sager at netapp.com>
---
 fs/nfs/client.c           |   22 +++++++++++++---------
 fs/nfs/nfs4proc.c         |    5 ++---
 include/linux/nfs_fs_sb.h |    1 +
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c3451cf..9c50be3 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -984,11 +984,10 @@ static int nfs4_init_client(struct nfs_client *clp,
 		return 0;
 	}
 
-#if defined(CONFIG_NFS_V4_1)
-	clp->cl_boot_time = CURRENT_TIME;
-	clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
-	clp->cl_minorversion = NFS4_MAX_MINOR_VERSION;
-#endif /* CONFIG_NFS_V4_1 */
+	if (clp->cl_minorversion == 1) {
+		clp->cl_boot_time = CURRENT_TIME;
+		clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED;
+	}
 
 	/* Check NFS protocol revision and initialize RPC op vector */
 	clp->rpc_ops = nfsv4_minorversion_clientops[clp->cl_minorversion];
@@ -1060,6 +1059,7 @@ int nfs4_set_client(struct nfs_server *server,
 		error = PTR_ERR(clp);
 		goto error;
 	}
+	clp->cl_minorversion = server->minorversion;
 	error = nfs4_init_client(clp, timeparms, ip_addr, authflavour);
 	if (error < 0)
 		goto error_put;
@@ -1180,6 +1180,8 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
 	if (!server)
 		return ERR_PTR(-ENOMEM);
 
+	server->minorversion = data->minorvers;
+
 	/* set up the general RPC client */
 	error = nfs4_init_server(server, data);
 	if (error < 0)
@@ -1190,10 +1192,12 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
 	BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
 
 #if defined(CONFIG_NFS_V4_1)
-	error = nfs4_init_session(server->nfs_client, &server->session,
-				  server->client);
-	if (error)
-		goto error;
+	if (server->minorversion == 1) {
+		error = nfs4_init_session(server->nfs_client, &server->session,
+					  server->client);
+		if (error)
+			goto error;
+	}
 #endif /* CONFIG_NFS_V4_1 */
 
 	/* Probe the root fh to retrieve its FSID */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cd1eee8..741778a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1762,9 +1762,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
 	if (calldata->arg.seqid == NULL)
 		goto out_free_calldata;
 	calldata->arg.stateid = &state->open_stateid;
-#ifdef CONFIG_NFS_V4_1
-	memset(&calldata->arg.stateid->data, 0, 4);
-#endif /* CONFIG_NFS_V4_1 */
+	if (server->minorversion == 1)
+		memset(&calldata->arg.stateid->data, 0, 4);
 	calldata->arg.bitmask = server->attr_bitmask;
 	calldata->res.fattr = &calldata->fattr;
 	calldata->res.server = server;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 6746eb9..7dd91de 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -130,6 +130,7 @@ struct nfs_server {
 	u32			acl_bitmask;	/* V4 bitmask representing the ACEs
 						   that are supported on this
 						   filesystem */
+	u32			minorversion;
 #endif
 
 #ifdef CONFIG_NFS_V4_1
-- 
1.5.3.3



More information about the pNFS mailing list