From owner-svn-src-head@freebsd.org  Wed Mar 11 21:00:41 2020
Return-Path: <owner-svn-src-head@freebsd.org>
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 0802226A70B;
 Wed, 11 Mar 2020 21:00:41 +0000 (UTC)
 (envelope-from mckusick@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 48d49h6M1Rz49gf;
 Wed, 11 Mar 2020 21:00:40 +0000 (UTC)
 (envelope-from mckusick@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 D564E1A7FC;
 Wed, 11 Mar 2020 21:00:40 +0000 (UTC)
 (envelope-from mckusick@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02BL0eNJ016368;
 Wed, 11 Mar 2020 21:00:40 GMT (envelope-from mckusick@FreeBSD.org)
Received: (from mckusick@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02BL0esU016367;
 Wed, 11 Mar 2020 21:00:40 GMT (envelope-from mckusick@FreeBSD.org)
Message-Id: <202003112100.02BL0esU016367@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: mckusick set sender to
 mckusick@FreeBSD.org using -f
From: Kirk McKusick <mckusick@FreeBSD.org>
Date: Wed, 11 Mar 2020 21:00:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r358899 - in head: lib/libc/sys sys/ufs/ffs
X-SVN-Group: head
X-SVN-Commit-Author: mckusick
X-SVN-Commit-Paths: in head: lib/libc/sys sys/ufs/ffs
X-SVN-Commit-Revision: 358899
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
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 11 Mar 2020 21:00:41 -0000

Author: mckusick
Date: Wed Mar 11 21:00:40 2020
New Revision: 358899
URL: https://svnweb.freebsd.org/changeset/base/358899

Log:
  When mounting a UFS filesystem, return EINTEGRITY rather than EIO
  when a superblock check-hash error is detected. This change clarifies
  a mount that failed due to media hardware failures (EIO) from a mount
  that failed due to media errors (EINTEGRITY) that can be corrected by
  running fsck(8).
  
  Sponsored by: Netflix

Modified:
  head/lib/libc/sys/mount.2
  head/sys/ufs/ffs/ffs_subr.c

Modified: head/lib/libc/sys/mount.2
==============================================================================
--- head/lib/libc/sys/mount.2	Wed Mar 11 20:40:24 2020	(r358898)
+++ head/lib/libc/sys/mount.2	Wed Mar 11 21:00:40 2020	(r358899)
@@ -307,6 +307,10 @@ No space remains in the mount table.
 .It Bq Er EINVAL
 The super block for the file system had a bad magic
 number or an out of range block size.
+.It Bq Er EINTEGRITY
+The super block for the file system had a bad check hash.
+The check hash can usually be corrected by running
+.Xr fsck 8 .
 .It Bq Er ENOMEM
 Not enough memory was available to read the cylinder
 group information for the file system.

Modified: head/sys/ufs/ffs/ffs_subr.c
==============================================================================
--- head/sys/ufs/ffs/ffs_subr.c	Wed Mar 11 20:40:24 2020	(r358898)
+++ head/sys/ufs/ffs/ffs_subr.c	Wed Mar 11 21:00:40 2020	(r358899)
@@ -416,7 +416,7 @@ readsuper(void *devfd, struct fs **fsp, off_t sblocklo
 				return (0);
 			}
 			fs->fs_fmod = 0;
-			return (EINVAL);
+			return (EINTEGRITY);
 		}
 		/* Have to set for old filesystems that predate this field */
 		fs->fs_sblockactualloc = sblockloc;