client.c (84abd88a70090cf00f9e45c3a81680874f17626e) client.c (888ef2e3f8b7b8daeb031bfb4ad1fd4fa817e193)
1/* client.c: NFS client sharing and management code
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 150 unchanged lines hidden (view full) ---

159 return clp;
160
161error_cleanup:
162 kfree(clp);
163error_0:
164 return ERR_PTR(err);
165}
166
1/* client.c: NFS client sharing and management code
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 150 unchanged lines hidden (view full) ---

159 return clp;
160
161error_cleanup:
162 kfree(clp);
163error_0:
164 return ERR_PTR(err);
165}
166
167static void nfs4_shutdown_client(struct nfs_client *clp)
168{
169#ifdef CONFIG_NFS_V4
167#ifdef CONFIG_NFS_V4
170 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
171 nfs4_kill_renewd(clp);
172 BUG_ON(!RB_EMPTY_ROOT(&clp->cl_state_owners));
173 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
174 nfs_idmap_delete(clp);
175
176 rpc_destroy_wait_queue(&clp->cl_rpcwaitq);
177#endif
178}
179
180/*
168/*
181 * Destroy the NFS4 callback service
182 */
183static void nfs4_destroy_callback(struct nfs_client *clp)
184{
185#ifdef CONFIG_NFS_V4
186 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
187 nfs_callback_down(clp->cl_minorversion);
188#endif /* CONFIG_NFS_V4 */
189}
190
191/*
192 * Clears/puts all minor version specific parts from an nfs_client struct
193 * reverting it to minorversion 0.
194 */
195static void nfs4_clear_client_minor_version(struct nfs_client *clp)
196{
197#ifdef CONFIG_NFS_V4_1
198 if (nfs4_has_session(clp)) {
199 nfs4_destroy_session(clp->cl_session);
200 clp->cl_session = NULL;
201 }
202
203 clp->cl_call_sync = _nfs4_call_sync;
204#endif /* CONFIG_NFS_V4_1 */
169 * Clears/puts all minor version specific parts from an nfs_client struct
170 * reverting it to minorversion 0.
171 */
172static void nfs4_clear_client_minor_version(struct nfs_client *clp)
173{
174#ifdef CONFIG_NFS_V4_1
175 if (nfs4_has_session(clp)) {
176 nfs4_destroy_session(clp->cl_session);
177 clp->cl_session = NULL;
178 }
179
180 clp->cl_call_sync = _nfs4_call_sync;
181#endif /* CONFIG_NFS_V4_1 */
182}
205
183
184/*
185 * Destroy the NFS4 callback service
186 */
187static void nfs4_destroy_callback(struct nfs_client *clp)
188{
189 if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
190 nfs_callback_down(clp->cl_minorversion);
191}
192
193static void nfs4_shutdown_client(struct nfs_client *clp)
194{
195 if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
196 nfs4_kill_renewd(clp);
197 nfs4_clear_client_minor_version(clp);
206 nfs4_destroy_callback(clp);
198 nfs4_destroy_callback(clp);
199 if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
200 nfs_idmap_delete(clp);
201
202 rpc_destroy_wait_queue(&clp->cl_rpcwaitq);
207}
203}
204#else
205static void nfs4_shutdown_client(struct nfs_client *clp)
206{
207}
208#endif /* CONFIG_NFS_V4 */
208
209/*
210 * Destroy a shared client record
211 */
212static void nfs_free_client(struct nfs_client *clp)
213{
214 dprintk("--> nfs_free_client(%u)\n", clp->rpc_ops->version);
215
209
210/*
211 * Destroy a shared client record
212 */
213static void nfs_free_client(struct nfs_client *clp)
214{
215 dprintk("--> nfs_free_client(%u)\n", clp->rpc_ops->version);
216
216 nfs4_clear_client_minor_version(clp);
217 nfs4_shutdown_client(clp);
218
219 nfs_fscache_release_client_cookie(clp);
220
221 /* -EIO all pending I/O */
222 if (!IS_ERR(clp->cl_rpcclient))
223 rpc_shutdown_client(clp->cl_rpcclient);
224

--- 1556 unchanged lines hidden ---
217 nfs4_shutdown_client(clp);
218
219 nfs_fscache_release_client_cookie(clp);
220
221 /* -EIO all pending I/O */
222 if (!IS_ERR(clp->cl_rpcclient))
223 rpc_shutdown_client(clp->cl_rpcclient);
224

--- 1556 unchanged lines hidden ---