diff options
-rw-r--r-- | fs/nfs/client.c | 40 | ||||
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs3proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4_fs.h | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/proc.c | 1 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 2 |
7 files changed, 34 insertions, 14 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 82cb8a386a8f..254719c4a575 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -147,7 +147,7 @@ struct nfs_client_initdata { | |||
147 | * Since these are allocated/deallocated very rarely, we don't | 147 | * Since these are allocated/deallocated very rarely, we don't |
148 | * bother putting them in a slab cache... | 148 | * bother putting them in a slab cache... |
149 | */ | 149 | */ |
150 | static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) | 150 | struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_init) |
151 | { | 151 | { |
152 | struct nfs_client *clp; | 152 | struct nfs_client *clp; |
153 | struct rpc_cred *cred; | 153 | struct rpc_cred *cred; |
@@ -177,18 +177,6 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ | |||
177 | clp->cl_proto = cl_init->proto; | 177 | clp->cl_proto = cl_init->proto; |
178 | clp->cl_net = get_net(cl_init->net); | 178 | clp->cl_net = get_net(cl_init->net); |
179 | 179 | ||
180 | #ifdef CONFIG_NFS_V4 | ||
181 | err = nfs_get_cb_ident_idr(clp, cl_init->minorversion); | ||
182 | if (err) | ||
183 | goto error_cleanup; | ||
184 | |||
185 | spin_lock_init(&clp->cl_lock); | ||
186 | INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); | ||
187 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); | ||
188 | clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; | ||
189 | clp->cl_minorversion = cl_init->minorversion; | ||
190 | clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; | ||
191 | #endif | ||
192 | cred = rpc_lookup_machine_cred("*"); | 180 | cred = rpc_lookup_machine_cred("*"); |
193 | if (!IS_ERR(cred)) | 181 | if (!IS_ERR(cred)) |
194 | clp->cl_machine_cred = cred; | 182 | clp->cl_machine_cred = cred; |
@@ -218,6 +206,30 @@ static void nfs4_shutdown_session(struct nfs_client *clp) | |||
218 | } | 206 | } |
219 | #endif /* CONFIG_NFS_V4_1 */ | 207 | #endif /* CONFIG_NFS_V4_1 */ |
220 | 208 | ||
209 | struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init) | ||
210 | { | ||
211 | int err; | ||
212 | struct nfs_client *clp = nfs_alloc_client(cl_init); | ||
213 | if (IS_ERR(clp)) | ||
214 | return clp; | ||
215 | |||
216 | err = nfs_get_cb_ident_idr(clp, cl_init->minorversion); | ||
217 | if (err) | ||
218 | goto error; | ||
219 | |||
220 | spin_lock_init(&clp->cl_lock); | ||
221 | INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); | ||
222 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); | ||
223 | clp->cl_state = 1 << NFS4CLNT_LEASE_EXPIRED; | ||
224 | clp->cl_minorversion = cl_init->minorversion; | ||
225 | clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; | ||
226 | return clp; | ||
227 | |||
228 | error: | ||
229 | kfree(clp); | ||
230 | return ERR_PTR(err); | ||
231 | } | ||
232 | |||
221 | /* | 233 | /* |
222 | * Destroy the NFS4 callback service | 234 | * Destroy the NFS4 callback service |
223 | */ | 235 | */ |
@@ -588,7 +600,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, | |||
588 | 600 | ||
589 | spin_unlock(&nn->nfs_client_lock); | 601 | spin_unlock(&nn->nfs_client_lock); |
590 | 602 | ||
591 | new = nfs_alloc_client(cl_init); | 603 | new = cl_init->rpc_ops->alloc_client(cl_init); |
592 | } while (!IS_ERR(new)); | 604 | } while (!IS_ERR(new)); |
593 | 605 | ||
594 | dprintk("<-- nfs_get_client() Failed to find %s (%ld)\n", | 606 | dprintk("<-- nfs_get_client() Failed to find %s (%ld)\n", |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 93b732523342..633af813984d 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -148,6 +148,7 @@ extern void nfs_umount(const struct nfs_mount_request *info); | |||
148 | /* client.c */ | 148 | /* client.c */ |
149 | extern const struct rpc_program nfs_program; | 149 | extern const struct rpc_program nfs_program; |
150 | extern void nfs_clients_init(struct net *net); | 150 | extern void nfs_clients_init(struct net *net); |
151 | extern struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *); | ||
151 | 152 | ||
152 | extern void nfs_cleanup_cb_ident_idr(struct net *); | 153 | extern void nfs_cleanup_cb_ident_idr(struct net *); |
153 | extern void nfs_put_client(struct nfs_client *); | 154 | extern void nfs_put_client(struct nfs_client *); |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 4ccb34bf1732..77c7aac228bb 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -934,6 +934,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { | |||
934 | .close_context = nfs_close_context, | 934 | .close_context = nfs_close_context, |
935 | .have_delegation = nfs3_have_delegation, | 935 | .have_delegation = nfs3_have_delegation, |
936 | .return_delegation = nfs3_return_delegation, | 936 | .return_delegation = nfs3_return_delegation, |
937 | .alloc_client = nfs_alloc_client, | ||
937 | .init_client = nfs_init_client, | 938 | .init_client = nfs_init_client, |
938 | .free_client = nfs_free_client, | 939 | .free_client = nfs_free_client, |
939 | }; | 940 | }; |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 9889ee476e37..a0be2d1af04b 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -303,6 +303,8 @@ extern const u32 nfs4_fs_locations_bitmap[2]; | |||
303 | 303 | ||
304 | void nfs4_free_client(struct nfs_client *); | 304 | void nfs4_free_client(struct nfs_client *); |
305 | 305 | ||
306 | struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *); | ||
307 | |||
306 | /* nfs4renewd.c */ | 308 | /* nfs4renewd.c */ |
307 | extern void nfs4_schedule_state_renewal(struct nfs_client *); | 309 | extern void nfs4_schedule_state_renewal(struct nfs_client *); |
308 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); | 310 | extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f301c53926b2..7f39e7ecde6c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6806,6 +6806,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = { | |||
6806 | .open_context = nfs4_atomic_open, | 6806 | .open_context = nfs4_atomic_open, |
6807 | .have_delegation = nfs4_have_delegation, | 6807 | .have_delegation = nfs4_have_delegation, |
6808 | .return_delegation = nfs4_inode_return_delegation, | 6808 | .return_delegation = nfs4_inode_return_delegation, |
6809 | .alloc_client = nfs4_alloc_client, | ||
6809 | .init_client = nfs4_init_client, | 6810 | .init_client = nfs4_init_client, |
6810 | .free_client = nfs4_free_client, | 6811 | .free_client = nfs4_free_client, |
6811 | }; | 6812 | }; |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 53620bf10969..99a002515dfe 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -790,6 +790,7 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
790 | .close_context = nfs_close_context, | 790 | .close_context = nfs_close_context, |
791 | .have_delegation = nfs_have_delegation, | 791 | .have_delegation = nfs_have_delegation, |
792 | .return_delegation = nfs_return_delegation, | 792 | .return_delegation = nfs_return_delegation, |
793 | .alloc_client = nfs_alloc_client, | ||
793 | .init_client = nfs_init_client, | 794 | .init_client = nfs_init_client, |
794 | .free_client = nfs_free_client, | 795 | .free_client = nfs_free_client, |
795 | }; | 796 | }; |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index e61dc7235d5d..4d62b774ddaf 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1353,6 +1353,7 @@ struct nfs_renamedata { | |||
1353 | struct nfs_access_entry; | 1353 | struct nfs_access_entry; |
1354 | struct nfs_client; | 1354 | struct nfs_client; |
1355 | struct rpc_timeout; | 1355 | struct rpc_timeout; |
1356 | struct nfs_client_initdata; | ||
1356 | 1357 | ||
1357 | /* | 1358 | /* |
1358 | * RPC procedure vector for NFSv2/NFSv3 demuxing | 1359 | * RPC procedure vector for NFSv2/NFSv3 demuxing |
@@ -1424,6 +1425,7 @@ struct nfs_rpc_ops { | |||
1424 | struct iattr *iattr); | 1425 | struct iattr *iattr); |
1425 | int (*have_delegation)(struct inode *, fmode_t); | 1426 | int (*have_delegation)(struct inode *, fmode_t); |
1426 | int (*return_delegation)(struct inode *); | 1427 | int (*return_delegation)(struct inode *); |
1428 | struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); | ||
1427 | struct nfs_client * | 1429 | struct nfs_client * |
1428 | (*init_client) (struct nfs_client *, const struct rpc_timeout *, | 1430 | (*init_client) (struct nfs_client *, const struct rpc_timeout *, |
1429 | const char *, rpc_authflavor_t); | 1431 | const char *, rpc_authflavor_t); |