svn commit: r356009 - stable/12/sbin/camcontrol
Alexander Motin
mav at FreeBSD.org
Sun Dec 22 17:00:54 UTC 2019
Author: mav
Date: Sun Dec 22 17:00:53 2019
New Revision: 356009
URL: https://svnweb.freebsd.org/changeset/base/356009
Log:
MFC r355788: Properly detect ATA sanitize errors.
It seems I read specifications not careful enough. There are devices not
setting successful completion bit, causing previous code report false error.
Modified:
stable/12/sbin/camcontrol/camcontrol.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sbin/camcontrol/camcontrol.c
==============================================================================
--- stable/12/sbin/camcontrol/camcontrol.c Sun Dec 22 16:57:19 2019 (r356008)
+++ stable/12/sbin/camcontrol/camcontrol.c Sun Dec 22 17:00:53 2019 (r356009)
@@ -6692,6 +6692,25 @@ sanitize_wait_ata(struct cam_device *device, union ccb
return (retval);
}
if (status & ATA_STATUS_ERROR) {
+ if (error & ATA_ERROR_ABORT) {
+ switch (lba & 0xff) {
+ case 0x00:
+ warnx("Reason not reported or sanitize failed.");
+ return (1);
+ case 0x01:
+ warnx("Sanitize command unsuccessful. ");
+ return (1);
+ case 0x02:
+ warnx("Unsupported sanitize device command. ");
+ return (1);
+ case 0x03:
+ warnx("Device is in sanitize frozen state. ");
+ return (1);
+ case 0x04:
+ warnx("Sanitize antifreeze lock is enabled. ");
+ return (1);
+ }
+ }
warnx("SANITIZE STATUS EXT failed, "
"sanitize may still run.");
return (1);
@@ -6708,9 +6727,6 @@ sanitize_wait_ata(struct cam_device *device, union ccb
fflush(stdout);
}
sleep(1);
- } else if ((count & 0x8000) == 0) {
- warnx("Sanitize complete with an error. ");
- return (1);
} else
break;
} while (1);
More information about the svn-src-all
mailing list