diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-01 09:21:53 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 13:46:19 -0400 |
commit | 557134a39c8d2ab79d8b8d53438e03e29feb5ec4 (patch) | |
tree | 3f6999d9601618102413fd535ff95f9be0babd85 /fs/nfs/client.c | |
parent | 9ff71c3a9827b99699510076dffa0bbe7c36bfd4 (diff) |
nfs41: sessions client infrastructure
NFSv4.1 Sessions basic data types, initialization, and destruction.
The session is always associated with a struct nfs_client that holds
the exchange_id results.
Signed-off-by: Rahul Iyer <iyer@netapp.com>
Signed-off-by: Andy Adamson<andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[remove extraneous rpc_clnt pointer, use the struct nfs_client cl_rpcclient.
remove the rpc_clnt parameter from nfs4 nfs4_init_session]
Signed-off-by: Andy Adamson<andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[Use the presence of a session to determine behaviour instead of the
minorversion number.]
Signed-off-by: Andy Adamson <andros@netapp.com>
[constified nfs4_has_session's struct nfs_client parameter]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[Rename nfs4_put_session() to nfs4_destroy_session() and call it from nfs4_free_client() not nfs4_free_server().
Also get rid of nfs4_get_session() and the ref_count in nfs4_session struct as keeping track of nfs_client should be sufficient]
Signed-off-by: Alexandros Batsakis <Alexandros.Batsakis@netapp.com>
[nfs41: pass rsize and wsize into nfs4_init_session]
Signed-off-by: Andy Adamson <andros@netapp.com>
[separated out removal of rpc_clnt parameter from nfs4_init_session ot a
patch of its own]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[Pass the nfs_client pointer into nfs4_alloc_session]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: don't assign to session->clp->cl_session in nfs4_destroy_session]
[nfs41: fixup nfs4_clear_client_minor_version]
[introduce nfs4_clear_client_minor_version() in this patch]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[Refactor nfs4_init_session]
Moved session allocation into nfs4_init_client_minor_version, called from
nfs4_init_client.
Leave rwise and wsize initialization in nfs4_init_session, called from
nfs4_init_server.
Reverted moving of nfs_fsid definition to nfs_fs_sb.h
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: Move NFS4_MAX_SLOT_TABLE define from under CONFIG_NFS_V4_1]
[Fix comile error when CONFIG_NFS_V4_1 is not set.]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[moved nfs4_init_slot_table definition to "create_session operation"]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfs41: alloc session with GFP_KERNEL]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 60 |
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 | */ | ||
190 | static 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 | */ |
189 | static void nfs_free_client(struct nfs_client *clp) | 203 | static 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 | */ | ||
1074 | static 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 | */ |
1059 | static int nfs4_init_client(struct nfs_client *clp, | 1098 | static 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 | */ | ||
1193 | static 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 | */ |
1149 | static int nfs4_init_server(struct nfs_server *server, | 1207 | static 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) |