Message ID | a2853778dc15eec5eb3b09ddcc3b3e911254c19a.1438763531.git.zhaolei@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Aug 05, 2015 at 04:32:26PM +0800, Zhao Lei wrote: > 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, In what way is it broken? Can we turn it into tests? > 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) The net effect of the patch is to add ret=.. and errno=.. to the error message but it also changes a series of ifs to a switch. This belongs to a separate patch. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, David Sterba Thanks for review this patch. > -----Original Message----- > From: David Sterba [mailto:dsterba@suse.com] > Sent: Thursday, August 06, 2015 12:51 AM > To: Zhao Lei > Cc: linux-btrfs@vger.kernel.org > Subject: Re: [PATCH] btrfs-progs: Modify confuse error message in scrub > > On Wed, Aug 05, 2015 at 04:32:26PM +0800, Zhao Lei wrote: > > 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, > > In what way is it broken? Can we turn it into tests? > It is caused by my custom-made condition, created for debugg another problem in kernel code, and see above outout in xfstests. It is not a real problem for normal user, so not necessary to add A testcase to fstests and user-land tests. But for btrfs-progs, it should not output such message on any case, this is what this patch fixed. > > 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) > > The net effect of the patch is to add ret=.. and errno=.. to the error message > but it also changes a series of ifs to a switch. This belongs to a separate patch. OK, will send v2. Thanks Zhaolei -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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++;
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(-)