All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhao Lei <zhaolei@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
Subject: [PATCH] btrfs-progs: Modify confuse error message in scrub
Date: Wed, 5 Aug 2015 16:32:26 +0800	[thread overview]
Message-ID: <a2853778dc15eec5eb3b09ddcc3b3e911254c19a.1438763531.git.zhaolei@cn.fujitsu.com> (raw)

Scrub output following error message in my test:
  ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5 (Success)

It is caused by a broken kernel and fs, but the we need to avoid
outputting both "error and success" in oneline message as above.

This patch modified above message to:
  ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5, ret=1, errno=0(Success)

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 cmds-scrub.c | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/cmds-scrub.c b/cmds-scrub.c
index 7c9318e..2529956 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -1457,21 +1457,25 @@ static int scrub_start(int argc, char **argv, int resume)
 			++err;
 			continue;
 		}
-		if (sp[i].ret && sp[i].ioctl_errno == ENODEV) {
-			if (do_print)
-				fprintf(stderr, "WARNING: device %lld not "
-					"present\n", devid);
-			continue;
-		}
-		if (sp[i].ret && sp[i].ioctl_errno == ECANCELED) {
-			++err;
-		} else if (sp[i].ret) {
-			if (do_print)
-				fprintf(stderr, "ERROR: scrubbing %s failed "
-					"for device id %lld (%s)\n", path,
-					devid, strerror(sp[i].ioctl_errno));
-			++err;
-			continue;
+		if (sp[i].ret) {
+			switch (sp[i].ioctl_errno) {
+			case ENODEV:
+				if (do_print)
+					fprintf(stderr, "WARNING: device %lld not present\n",
+						devid);
+				continue;
+			case ECANCELED:
+				++err;
+				break;
+			default:
+				if (do_print)
+					fprintf(stderr, "ERROR: scrubbing %s failed for device id %lld, ret=%d, errno=%d(%s)\n",
+						path, devid,
+						sp[i].ret, sp[i].ioctl_errno,
+						strerror(sp[i].ioctl_errno));
+				++err;
+				continue;
+			}
 		}
 		if (sp[i].scrub_args.progress.uncorrectable_errors > 0)
 			e_uncorrectable++;
-- 
1.8.5.1


             reply	other threads:[~2015-08-05  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  8:32 Zhao Lei [this message]
2015-08-05 16:50 ` [PATCH] btrfs-progs: Modify confuse error message in scrub David Sterba
2015-08-06  2:00   ` Zhao Lei

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=a2853778dc15eec5eb3b09ddcc3b3e911254c19a.1438763531.git.zhaolei@cn.fujitsu.com \
    --to=zhaolei@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.