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@xxxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html