aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2016-07-19 20:54:09 -0400
committerDave Chinner <david@fromorbit.com>2016-07-19 20:54:09 -0400
commit5539d36752eb789f4067a9f88e72177895d56317 (patch)
tree0df524b1fbd6708ed3c6f0cd710de40a8084b466
parent0b4db5dff3599b46957bfd8a4c66945c915e26d3 (diff)
xfs: don't reset b_retries to 0 on every failure
With the code as it stands today, b_retries never increments because it gets reset to 0 in the error callback. Remove that, and fix a similar problem where the first retry time was constantly being overwritten, which defeated the timeout tunable as well. We now only set first retry time if a non-zero timeout is set, to match the behavior of only incrementing retries if a retry value is set. This way max retries & timeouts consistently take effect after a tunable is set, rather than acting retroactively on a buffer which has failed at some point in the past and has accumulated state from those prior failures. Thanks to dchinner for talking through this with me. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_buf_item.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 6a2f429391cc..3b19e5219d9a 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1073,6 +1073,8 @@ xfs_buf_iodone_callback_error(
1073 trace_xfs_buf_item_iodone_async(bp, _RET_IP_); 1073 trace_xfs_buf_item_iodone_async(bp, _RET_IP_);
1074 ASSERT(bp->b_iodone != NULL); 1074 ASSERT(bp->b_iodone != NULL);
1075 1075
1076 cfg = xfs_error_get_cfg(mp, XFS_ERR_METADATA, bp->b_error);
1077
1076 /* 1078 /*
1077 * If the write was asynchronous then no one will be looking for the 1079 * If the write was asynchronous then no one will be looking for the
1078 * error. If this is the first failure of this type, clear the error 1080 * error. If this is the first failure of this type, clear the error
@@ -1084,8 +1086,8 @@ xfs_buf_iodone_callback_error(
1084 bp->b_last_error != bp->b_error) { 1086 bp->b_last_error != bp->b_error) {
1085 bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL); 1087 bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL);
1086 bp->b_last_error = bp->b_error; 1088 bp->b_last_error = bp->b_error;
1087 bp->b_retries = 0; 1089 if (cfg->retry_timeout && !bp->b_first_retry_time)
1088 bp->b_first_retry_time = jiffies; 1090 bp->b_first_retry_time = jiffies;
1089 1091
1090 xfs_buf_ioerror(bp, 0); 1092 xfs_buf_ioerror(bp, 0);
1091 xfs_buf_submit(bp); 1093 xfs_buf_submit(bp);
@@ -1096,7 +1098,6 @@ xfs_buf_iodone_callback_error(
1096 * Repeated failure on an async write. Take action according to the 1098 * Repeated failure on an async write. Take action according to the
1097 * error configuration we have been set up to use. 1099 * error configuration we have been set up to use.
1098 */ 1100 */
1099 cfg = xfs_error_get_cfg(mp, XFS_ERR_METADATA, bp->b_error);
1100 1101
1101 if (cfg->max_retries != XFS_ERR_RETRY_FOREVER && 1102 if (cfg->max_retries != XFS_ERR_RETRY_FOREVER &&
1102 ++bp->b_retries > cfg->max_retries) 1103 ++bp->b_retries > cfg->max_retries)