diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-18 17:01:12 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:09 -0400 |
commit | 25c7533357a4c4a9311d40cc92e9648c8a7e763e (patch) | |
tree | e38cc8e24d50ba9390dc669b448e8bb644def788 /fs | |
parent | b9e028fd89d6834558aa2a5bb30e5cff5c6c1059 (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')
-rw-r--r-- | fs/nfs/pnfs.c | 15 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 1 |
2 files changed, 15 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) | |||
248 | static void | 249 | static void |
249 | pnfs_layout_io_set_failed(struct pnfs_layout_hdr *lo, u32 iomode) | 250 | pnfs_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) | |||
256 | static bool | 258 | static bool |
257 | pnfs_layout_io_test_failed(struct pnfs_layout_hdr *lo, u32 iomode) | 259 | pnfs_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 | ||
262 | static void | 275 | static void |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index e3eb7d1b17a8..bc8e5001203d 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -140,6 +140,7 @@ struct pnfs_layout_hdr { | |||
140 | atomic_t plh_outstanding; /* number of RPCs out */ | 140 | atomic_t plh_outstanding; /* number of RPCs out */ |
141 | unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ | 141 | unsigned long plh_block_lgets; /* block LAYOUTGET if >0 */ |
142 | u32 plh_barrier; /* ignore lower seqids */ | 142 | u32 plh_barrier; /* ignore lower seqids */ |
143 | unsigned long plh_retry_timestamp; | ||
143 | unsigned long plh_flags; | 144 | unsigned long plh_flags; |
144 | loff_t plh_lwb; /* last write byte for layoutcommit */ | 145 | loff_t plh_lwb; /* last write byte for layoutcommit */ |
145 | struct rpc_cred *plh_lc_cred; /* layoutcommit cred */ | 146 | struct rpc_cred *plh_lc_cred; /* layoutcommit cred */ |