aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r--fs/nfs/client.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index a736160046c3..f1506f148521 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -184,12 +184,27 @@ static void nfs4_shutdown_client(struct nfs_client *clp)
184} 184}
185 185
186/* 186/*
187 * Clears/puts all minor version specific parts from an nfs_client struct
188 * reverting it to minorversion 0.
189 */
190static void nfs4_clear_client_minor_version(struct nfs_client *clp)
191{
192#ifdef CONFIG_NFS_V4_1
193 if (nfs4_has_session(clp)) {
194 nfs4_destroy_session(clp->cl_session);
195 clp->cl_session = NULL;
196 }
197#endif /* CONFIG_NFS_V4_1 */
198}
199
200/*
187 * Destroy a shared client record 201 * Destroy a shared client record
188 */ 202 */
189static void nfs_free_client(struct nfs_client *clp) 203static void nfs_free_client(struct nfs_client *clp)
190{ 204{
191 dprintk("--> nfs_free_client(%u)\n", clp->rpc_ops->version); 205 dprintk("--> nfs_free_client(%u)\n", clp->rpc_ops->version);
192 206
207 nfs4_clear_client_minor_version(clp);
193 nfs4_shutdown_client(clp); 208 nfs4_shutdown_client(clp);
194 209
195 nfs_fscache_release_client_cookie(clp); 210 nfs_fscache_release_client_cookie(clp);
@@ -1054,6 +1069,30 @@ error:
1054 1069
1055#ifdef CONFIG_NFS_V4 1070#ifdef CONFIG_NFS_V4
1056/* 1071/*
1072 * Initialize the minor version specific parts of an NFS4 client record
1073 */
1074static int nfs4_init_client_minor_version(struct nfs_client *clp)
1075{
1076#if defined(CONFIG_NFS_V4_1)
1077 if (clp->cl_minorversion) {
1078 struct nfs4_session *session = NULL;
1079 /*
1080 * Create the session and mark it expired.
1081 * When a SEQUENCE operation encounters the expired session
1082 * it will do session recovery to initialize it.
1083 */
1084 session = nfs4_alloc_session(clp);
1085 if (!session)
1086 return -ENOMEM;
1087
1088 clp->cl_session = session;
1089 }
1090#endif /* CONFIG_NFS_V4_1 */
1091
1092 return 0;
1093}
1094
1095/*
1057 * Initialise an NFS4 client record 1096 * Initialise an NFS4 client record
1058 */ 1097 */
1059static int nfs4_init_client(struct nfs_client *clp, 1098static int nfs4_init_client(struct nfs_client *clp,
@@ -1087,6 +1126,10 @@ static int nfs4_init_client(struct nfs_client *clp,
1087 } 1126 }
1088 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); 1127 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
1089 1128
1129 error = nfs4_init_client_minor_version(clp);
1130 if (error < 0)
1131 goto error;
1132
1090 nfs_mark_client_ready(clp, NFS_CS_READY); 1133 nfs_mark_client_ready(clp, NFS_CS_READY);
1091 return 0; 1134 return 0;
1092 1135
@@ -1144,6 +1187,21 @@ error:
1144} 1187}
1145 1188
1146/* 1189/*
1190 * Initialize a session.
1191 * Note: save the mount rsize and wsize for create_server negotiation.
1192 */
1193static void nfs4_init_session(struct nfs_client *clp,
1194 unsigned int wsize, unsigned int rsize)
1195{
1196#if defined(CONFIG_NFS_V4_1)
1197 if (nfs4_has_session(clp)) {
1198 clp->cl_session->fc_attrs.max_rqst_sz = wsize;
1199 clp->cl_session->fc_attrs.max_resp_sz = rsize;
1200 }
1201#endif /* CONFIG_NFS_V4_1 */
1202}
1203
1204/*
1147 * Create a version 4 volume record 1205 * Create a version 4 volume record
1148 */ 1206 */
1149static int nfs4_init_server(struct nfs_server *server, 1207static int nfs4_init_server(struct nfs_server *server,
@@ -1221,6 +1279,8 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
1221 BUG_ON(!server->nfs_client->rpc_ops); 1279 BUG_ON(!server->nfs_client->rpc_ops);
1222 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); 1280 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1223 1281
1282 nfs4_init_session(server->nfs_client, server->wsize, server->rsize);
1283
1224 /* Probe the root fh to retrieve its FSID */ 1284 /* Probe the root fh to retrieve its FSID */
1225 error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path); 1285 error = nfs4_path_walk(server, mntfh, data->nfs_server.export_path);
1226 if (error < 0) 1286 if (error < 0)