aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-11-26 13:13:29 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-12-05 18:30:45 -0500
commit330212796756ca2752b2a70a83860e145b77487c (patch)
tree5a2e26342a711c4a76136d935d658f73c59492b4 /fs/nfs
parent5d63360dd8daffc2bc86531e9a44ff9d4881b102 (diff)
NFSv4: Move nfs4_wait_clnt_recover and nfs4_client_recover_expired_lease
nfs4_wait_clnt_recover and nfs4_client_recover_expired_lease are both generic state related functions. As such, they belong in nfs4state.c, and not nfs4proc.c Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4_fs.h4
-rw-r--r--fs/nfs/nfs4proc.c36
-rw-r--r--fs/nfs/nfs4state.c34
3 files changed, 38 insertions, 36 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 16b19372c4ba..2f6a9f9d9299 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -11,6 +11,8 @@
11 11
12#if IS_ENABLED(CONFIG_NFS_V4) 12#if IS_ENABLED(CONFIG_NFS_V4)
13 13
14#define NFS4_MAX_LOOP_ON_RECOVER (10)
15
14struct idmap; 16struct idmap;
15 17
16enum nfs4_client_state { 18enum nfs4_client_state {
@@ -360,6 +362,8 @@ extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t);
360extern void nfs_inode_find_state_and_recover(struct inode *inode, 362extern void nfs_inode_find_state_and_recover(struct inode *inode,
361 const nfs4_stateid *stateid); 363 const nfs4_stateid *stateid);
362extern void nfs4_schedule_lease_recovery(struct nfs_client *); 364extern void nfs4_schedule_lease_recovery(struct nfs_client *);
365extern int nfs4_wait_clnt_recover(struct nfs_client *clp);
366extern int nfs4_client_recover_expired_lease(struct nfs_client *clp);
363extern void nfs4_schedule_state_manager(struct nfs_client *); 367extern void nfs4_schedule_state_manager(struct nfs_client *);
364extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); 368extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp);
365extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); 369extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0b0f11be40f9..d75e2a2576eb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -70,8 +70,6 @@
70#define NFS4_POLL_RETRY_MIN (HZ/10) 70#define NFS4_POLL_RETRY_MIN (HZ/10)
71#define NFS4_POLL_RETRY_MAX (15*HZ) 71#define NFS4_POLL_RETRY_MAX (15*HZ)
72 72
73#define NFS4_MAX_LOOP_ON_RECOVER (10)
74
75struct nfs4_opendata; 73struct nfs4_opendata;
76static int _nfs4_proc_open(struct nfs4_opendata *data); 74static int _nfs4_proc_open(struct nfs4_opendata *data);
77static int _nfs4_recover_proc_open(struct nfs4_opendata *data); 75static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
@@ -255,22 +253,6 @@ static void nfs4_setup_readdir(u64 cookie, __be32 *verifier, struct dentry *dent
255 kunmap_atomic(start); 253 kunmap_atomic(start);
256} 254}
257 255
258static int nfs4_wait_clnt_recover(struct nfs_client *clp)
259{
260 int res;
261
262 might_sleep();
263
264 res = wait_on_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING,
265 nfs_wait_bit_killable, TASK_KILLABLE);
266 if (res)
267 return res;
268
269 if (clp->cl_cons_state < 0)
270 return clp->cl_cons_state;
271 return 0;
272}
273
274static int nfs4_delay(struct rpc_clnt *clnt, long *timeout) 256static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
275{ 257{
276 int res = 0; 258 int res = 0;
@@ -1883,24 +1865,6 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
1883 return 0; 1865 return 0;
1884} 1866}
1885 1867
1886static int nfs4_client_recover_expired_lease(struct nfs_client *clp)
1887{
1888 unsigned int loop;
1889 int ret;
1890
1891 for (loop = NFS4_MAX_LOOP_ON_RECOVER; loop != 0; loop--) {
1892 ret = nfs4_wait_clnt_recover(clp);
1893 if (ret != 0)
1894 break;
1895 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1896 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state))
1897 break;
1898 nfs4_schedule_state_manager(clp);
1899 ret = -EIO;
1900 }
1901 return ret;
1902}
1903
1904static int nfs4_recover_expired_lease(struct nfs_server *server) 1868static int nfs4_recover_expired_lease(struct nfs_server *server)
1905{ 1869{
1906 return nfs4_client_recover_expired_lease(server->nfs_client); 1870 return nfs4_client_recover_expired_lease(server->nfs_client);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 1fb3e6c6f993..1077b9698381 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1216,6 +1216,40 @@ void nfs4_schedule_lease_recovery(struct nfs_client *clp)
1216} 1216}
1217EXPORT_SYMBOL_GPL(nfs4_schedule_lease_recovery); 1217EXPORT_SYMBOL_GPL(nfs4_schedule_lease_recovery);
1218 1218
1219int nfs4_wait_clnt_recover(struct nfs_client *clp)
1220{
1221 int res;
1222
1223 might_sleep();
1224
1225 res = wait_on_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING,
1226 nfs_wait_bit_killable, TASK_KILLABLE);
1227 if (res)
1228 return res;
1229
1230 if (clp->cl_cons_state < 0)
1231 return clp->cl_cons_state;
1232 return 0;
1233}
1234
1235int nfs4_client_recover_expired_lease(struct nfs_client *clp)
1236{
1237 unsigned int loop;
1238 int ret;
1239
1240 for (loop = NFS4_MAX_LOOP_ON_RECOVER; loop != 0; loop--) {
1241 ret = nfs4_wait_clnt_recover(clp);
1242 if (ret != 0)
1243 break;
1244 if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) &&
1245 !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state))
1246 break;
1247 nfs4_schedule_state_manager(clp);
1248 ret = -EIO;
1249 }
1250 return ret;
1251}
1252
1219/* 1253/*
1220 * nfs40_handle_cb_pathdown - return all delegations after NFS4ERR_CB_PATH_DOWN 1254 * nfs40_handle_cb_pathdown - return all delegations after NFS4ERR_CB_PATH_DOWN
1221 * @clp: client to process 1255 * @clp: client to process