Date: Sun, 22 Dec 2019 17:00:54 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356009 - stable/12/sbin/camcontrol Message-ID: <201912221700.xBMH0saI043876@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912221700.xBMH0saI043876>