linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: [PATCH 3/1] xfs: don't reset b_retries to 0 on every failure
Date: Fri, 8 Jul 2016 23:33:23 -0500	[thread overview]
Message-ID: <19d91779-cfb2-182d-e298-b4d5d1575182@sandeen.net> (raw)
In-Reply-To: <9810c6bf-9fd7-bf41-13ab-a96bec861457@redhat.com>

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>
---

diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 6a2f429..3b19e52 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -1073,6 +1073,8 @@ xfs_buf_iodone_callback_error(
 	trace_xfs_buf_item_iodone_async(bp, _RET_IP_);
 	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
 	 * error.  If this is the first failure of this type, clear the error
@@ -1084,8 +1086,8 @@ xfs_buf_iodone_callback_error(
 	     bp->b_last_error != bp->b_error) {
 		bp->b_flags |= (XBF_WRITE | XBF_DONE | XBF_WRITE_FAIL);
 		bp->b_last_error = bp->b_error;
-		bp->b_retries = 0;
-		bp->b_first_retry_time = jiffies;
+		if (cfg->retry_timeout && !bp->b_first_retry_time)
+			bp->b_first_retry_time = jiffies;
 
 		xfs_buf_ioerror(bp, 0);
 		xfs_buf_submit(bp);
@@ -1096,7 +1098,6 @@ xfs_buf_iodone_callback_error(
 	 * Repeated failure on an async write. Take action according to the
 	 * 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 &&
 	    ++bp->b_retries > cfg->max_retries)


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2016-07-09  4:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 19:32 [PATCH] xfs: fix xfs_error_get_cfg for negative errnos Eric Sandeen
2016-07-09  4:26 ` [PATCH 2/1] " Eric Sandeen
2016-07-09  4:28 ` [PATCH 2/1 V2] xfs: remove extraneous buffer flag changes Eric Sandeen
2016-07-19  7:57   ` Carlos Maiolino
2016-07-09  4:33 ` Eric Sandeen [this message]
2016-07-19  7:42   ` [PATCH 3/1] xfs: don't reset b_retries to 0 on every failure Carlos Maiolino
2016-07-19  7:52 ` [PATCH] xfs: fix xfs_error_get_cfg for negative errnos Carlos Maiolino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19d91779-cfb2-182d-e298-b4d5d1575182@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).