aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-18 17:01:12 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:09 -0400
commit25c7533357a4c4a9311d40cc92e9648c8a7e763e (patch)
treee38cc8e24d50ba9390dc669b448e8bb644def788 /fs/nfs/pnfs.c
parentb9e028fd89d6834558aa2a5bb30e5cff5c6c1059 (diff)
NFSv4.1: Retry pNFS after a 2 minute timeout
If we had to fall back to read/write through MDS, then assume that we should retry pNFS after a suitable timeout period. The following patch sets a timeout of 2 minutes. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f46f9bc4f767..2c59da5511db 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -35,6 +35,7 @@
35#include "iostat.h" 35#include "iostat.h"
36 36
37#define NFSDBG_FACILITY NFSDBG_PNFS 37#define NFSDBG_FACILITY NFSDBG_PNFS
38#define PNFS_LAYOUTGET_RETRY_TIMEOUT (120*HZ)
38 39
39/* Locking: 40/* Locking:
40 * 41 *
@@ -248,6 +249,7 @@ pnfs_iomode_to_fail_bit(u32 iomode)
248static void 249static void
249pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode) 250pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode)
250{ 251{
252 lo->plh_retry_timestamp = jiffies;
251 set_bit(pnfs_iomode_to_fail_bit(iomode), &lo->plh_flags); 253 set_bit(pnfs_iomode_to_fail_bit(iomode), &lo->plh_flags);
252 dprintk("%s Setting layout IOMODE_%s fail bit\n", __func__, 254 dprintk("%s Setting layout IOMODE_%s fail bit\n", __func__,
253 iomode == IOMODE_RW ? "RW" : "READ"); 255 iomode == IOMODE_RW ? "RW" : "READ");
@@ -256,7 +258,18 @@ pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode)
256static bool 258static bool
257pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode) 259pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode)
258{ 260{
259 return test_bit(pnfs_iomode_to_fail_bit(iomode), &lo->plh_flags) != 0; 261 unsigned long start, end;
262 if (test_bit(pnfs_iomode_to_fail_bit(iomode), &lo->plh_flags) == 0)
263 return false;
264 end = jiffies;
265 start = end - PNFS_LAYOUTGET_RETRY_TIMEOUT;
266 if (!time_in_range(lo->plh_retry_timestamp, start, end)) {
267 /* It is time to retry the failed layoutgets */
268 clear_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags);
269 clear_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags);
270 return false;
271 }
272 return true;
260} 273}
261 274
262static void 275static void