Commit 5539d367 authored by Eric Sandeen's avatar Eric Sandeen Committed by Dave Chinner

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: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 0b4db5df
...@@ -1073,6 +1073,8 @@ xfs_buf_iodone_callback_error( ...@@ -1073,6 +1073,8 @@ xfs_buf_iodone_callback_error(
trace_xfs_buf_item_iodone_async(bp, _RET_IP_); trace_xfs_buf_item_iodone_async(bp, _RET_IP_);
ASSERT(bp->b_iodone != NULL); ASSERT(bp->b_iodone != NULL);
cfg = xfs_error_get_cfg(mp, XFS_ERR_METADATA, bp->b_error);
/* /*
* If the write was asynchronous then no one will be looking for the * If the write was asynchronous then no one will be looking for the
* error. If this is the first failure of this type, clear the error * error. If this is the first failure of this type, clear the error
...@@ -1084,8 +1086,8 @@ xfs_buf_iodone_callback_error( ...@@ -1084,8 +1086,8 @@ xfs_buf_iodone_callback_error(
bp->b_last_error != bp->b_error) { bp->b_last_error != bp->b_error) {
bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL); bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL);
bp->b_last_error = bp->b_error; bp->b_last_error = bp->b_error;
bp->b_retries = 0; if (cfg->retry_timeout && !bp->b_first_retry_time)
bp->b_first_retry_time = jiffies; bp->b_first_retry_time = jiffies;
xfs_buf_ioerror(bp, 0); xfs_buf_ioerror(bp, 0);
xfs_buf_submit(bp); xfs_buf_submit(bp);
...@@ -1096,7 +1098,6 @@ xfs_buf_iodone_callback_error( ...@@ -1096,7 +1098,6 @@ xfs_buf_iodone_callback_error(
* Repeated failure on an async write. Take action according to the * Repeated failure on an async write. Take action according to the
* error configuration we have been set up to use. * error configuration we have been set up to use.
*/ */
cfg = xfs_error_get_cfg(mp, XFS_ERR_METADATA, bp->b_error);
if (cfg->max_retries != XFS_ERR_RETRY_FOREVER && if (cfg->max_retries != XFS_ERR_RETRY_FOREVER &&
++bp->b_retries > cfg->max_retries) ++bp->b_retries > cfg->max_retries)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment