aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2014-01-22 13:34:54 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-01-22 20:10:49 -0500
commited7e5423014ad89720fcf315c0b73f2c5d0c7bd2 (patch)
tree63d2a86b73ccd5bb2f5f447d3de8bdba03d07a71 /fs/nfs/nfs4proc.c
parent471252cd8b34b0609973740b25dcd1ff01dc1889 (diff)
pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done
An NFS4ERR_RECALLCONFLICT is returned by server from a GET_LAYOUT only when a Server Sent a RECALL do to that GET_LAYOUT, or the RECALL and GET_LAYOUT crossed on the wire. In any way this means we want to wait at most until in-flight IO is finished and the RECALL can be satisfied. So a proper wait here is more like 1/10 of a second, not 15 seconds like we have now. In case of a server bug we delay exponentially longer on each retry. Current code totally craps out performance of very large files on most pnfs-objects layouts, because of how the map changes when the file has grown into the next raid group. [Stable: This will patch back to 3.9. If there are earlier still maintained trees, please tell me I'll send a patch] CC: Stable Tree <stable@vger.kernel.org> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a9eaaaa436cb..a1965329a12c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7409,9 +7409,9 @@ static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
7409 struct nfs_server *server = NFS_SERVER(inode); 7409 struct nfs_server *server = NFS_SERVER(inode);
7410 struct pnfs_layout_hdr *lo; 7410 struct pnfs_layout_hdr *lo;
7411 struct nfs4_state *state = NULL; 7411 struct nfs4_state *state = NULL;
7412 unsigned long timeo, giveup; 7412 unsigned long timeo, now, giveup;
7413 7413
7414 dprintk("--> %s\n", __func__); 7414 dprintk("--> %s tk_status => %d\n", __func__, -task->tk_status);
7415 7415
7416 if (!nfs41_sequence_done(task, &lgp->res.seq_res)) 7416 if (!nfs41_sequence_done(task, &lgp->res.seq_res))
7417 goto out; 7417 goto out;
@@ -7419,12 +7419,38 @@ static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
7419 switch (task->tk_status) { 7419 switch (task->tk_status) {
7420 case 0: 7420 case 0:
7421 goto out; 7421 goto out;
7422 /*
7423 * NFS4ERR_LAYOUTTRYLATER is a conflict with another client
7424 * (or clients) writing to the same RAID stripe
7425 */
7422 case -NFS4ERR_LAYOUTTRYLATER: 7426 case -NFS4ERR_LAYOUTTRYLATER:
7427 /*
7428 * NFS4ERR_RECALLCONFLICT is when conflict with self (must recall
7429 * existing layout before getting a new one).
7430 */
7423 case -NFS4ERR_RECALLCONFLICT: 7431 case -NFS4ERR_RECALLCONFLICT:
7424 timeo = rpc_get_timeout(task->tk_client); 7432 timeo = rpc_get_timeout(task->tk_client);
7425 giveup = lgp->args.timestamp + timeo; 7433 giveup = lgp->args.timestamp + timeo;
7426 if (time_after(giveup, jiffies)) 7434 now = jiffies;
7427 task->tk_status = -NFS4ERR_DELAY; 7435 if (time_after(giveup, now)) {
7436 unsigned long delay;
7437
7438 /* Delay for:
7439 * - Not less then NFS4_POLL_RETRY_MIN.
7440 * - One last time a jiffie before we give up
7441 * - exponential backoff (time_now minus start_attempt)
7442 */
7443 delay = max_t(unsigned long, NFS4_POLL_RETRY_MIN,
7444 min((giveup - now - 1),
7445 now - lgp->args.timestamp));
7446
7447 dprintk("%s: NFS4ERR_RECALLCONFLICT waiting %lu\n",
7448 __func__, delay);
7449 rpc_delay(task, delay);
7450 task->tk_status = 0;
7451 rpc_restart_call_prepare(task);
7452 goto out; /* Do not call nfs4_async_handle_error() */
7453 }
7428 break; 7454 break;
7429 case -NFS4ERR_EXPIRED: 7455 case -NFS4ERR_EXPIRED:
7430 case -NFS4ERR_BAD_STATEID: 7456 case -NFS4ERR_BAD_STATEID: