From owner-svn-src-head@freebsd.org Sun Dec 15 23:28:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEFBA1D24AE; Sun, 15 Dec 2019 23:28:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47bgZs4d7xz45Q9; Sun, 15 Dec 2019 23:28:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A1E81C7DB; Sun, 15 Dec 2019 23:28:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBFNSrda008380; Sun, 15 Dec 2019 23:28:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBFNSr2f008379; Sun, 15 Dec 2019 23:28:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912152328.xBFNSr2f008379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 15 Dec 2019 23:28:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355788 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 355788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2019 23:28:53 -0000 Author: mav Date: Sun Dec 15 23:28:53 2019 New Revision: 355788 URL: https://svnweb.freebsd.org/changeset/base/355788 Log: 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. MFC after: 1 week Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sun Dec 15 22:41:57 2019 (r355787) +++ head/sbin/camcontrol/camcontrol.c Sun Dec 15 23:28:53 2019 (r355788) @@ -6667,6 +6667,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); @@ -6683,9 +6702,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);