From nobody Fri Aug 11 00:54:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RMQKn2DLMz4TpvV; Fri, 11 Aug 2023 00:54:21 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RMQKn1klkz3gSd; Fri, 11 Aug 2023 00:54:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691715261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Njf0Yzr5lH1lOG6pLk3zQ9wqMNsg868irq7pSDbyCxk=; b=tJAViWWxeS87kbRV63Ru6N+OzvdyaN5kN+EQevJ43Pw80OHC44kA6yI1T4uB2GQydJdLlu 938FpyjXoClp7NwaRji/bFndNVzwE0yksuPw+rMbXCZYDjQMIE3auV62xaxXggb+xXRQWi 6VVot+pMkKU0yv9DCEBNFXtUkoTozQiEFENwdHBtxFnihBa8NGuQoYr66SbdSUQOXWn6/a +6HnrUh86Wc80Lqq8Fo9eI5WrKFjgtrjJsenTsBA3awW1MMzu4QIqdRzhaHsvXMlIS0kKc PxCoE0gV2eV4dCY+qPFJcV+RjmsHGv6Vo1NtbfRV/BJnLvJelSirIN/MJyHL7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691715261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Njf0Yzr5lH1lOG6pLk3zQ9wqMNsg868irq7pSDbyCxk=; b=arCvHhqGtvMx1mmsOxXSXJZvqT3iamAe2nXTib7SZphvHd/H/zJyWUg8yQGVL3PGWcB8la eRbmY0mXWOurVNfXdkL86zra8yDpiPgz8n6R/2LL5Yu3mUhumcr/Dc6zwiFx9gUEcEaZTf NhkDOraY2Y6jThMxXIEv/Tsgfx2Ydg5WeQM1RcVGXFx6rExkg+98/ohEj9Wna1UVUAHiUI XhL1hNuLTczi/ut0KUzF5Lcpb4Qn5QmQ+EmKrHTIpIKXnltf2rWir0qdmgNty74B0yZtcJ iNYyNymZFAh1BtrtsEPiifKPHX8nyBKCApZf36wkSN4r+tSqPy0qURj99Tqnew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691715261; a=rsa-sha256; cv=none; b=E+7el1OQ/jtoTgwMHP23M0vgb54Iks5VEgLKpDVbARdUxekY4aOXtNyF5/JBAWuhhnIvHj Hvwy+n3wXvTF8wcAMfPZyxYce2PVlDejSi7OS19Q0hV8N5d3cJWdAxT+hsvuoPRCDkj3tY 1rE6usooIlNoNwcUPKbffrM7p+8RRBgJ59sQOZe5IzfWXLQO0elYH9vw/oIC1pRHFYgfIx 4BJy8pWWk4bd9lwiMmfI3gzojxfkKhlzGrzGESADmt5X/f5HYQnjAfM4jyTjJdo51iAS9R wJpzBlh1IyC4TeTbBac6d0KxzvSctl1QHF1Cz4iPdffLO7KqdrFnMkGESo3dQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RMQKn0Vblz4Tn; Fri, 11 Aug 2023 00:54:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37B0sKl6075218; Fri, 11 Aug 2023 00:54:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37B0sK3G075215; Fri, 11 Aug 2023 00:54:20 GMT (envelope-from git) Date: Fri, 11 Aug 2023 00:54:20 GMT Message-Id: <202308110054.37B0sK3G075215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 886fd36e1ac2 - main - Clean up and document UFS/FFS error returns. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 886fd36e1ac2082f1b0decb89d70e1e7a0dc3043 Auto-Submitted: auto-generated The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=886fd36e1ac2082f1b0decb89d70e1e7a0dc3043 commit 886fd36e1ac2082f1b0decb89d70e1e7a0dc3043 Author: Kirk McKusick AuthorDate: 2023-08-11 00:50:23 +0000 Commit: Kirk McKusick CommitDate: 2023-08-11 00:54:06 +0000 Clean up and document UFS/FFS error returns. The ffs_inotovp() function returns a vnode from a mounted filesystem for an inode number with specified generation number. We now consistently return ESTALE if the inode with given generation number no longer exists on that filesystem. The ffs_reload() function reloads all incore data for a filesystem. It is used after running fsck on a mounted filesystem and finding things to fix. It now returns the EINTEGRITY error if it is unable to find a valid superblock. MFC-after: 1 week Sponsored-by: The FreeBSD Foundation --- sys/ufs/ffs/ffs_vfsops.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index b2cd2d30bc04..41c3582a91ae 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -796,7 +796,7 @@ ffs_reload(struct mount *mp, int flags) newfs->fs_bsize > MAXBSIZE || newfs->fs_bsize < sizeof(struct fs)) { brelse(bp); - return (EIO); /* XXX needs translation */ + return (EINTEGRITY); } /* * Preserve the summary information, read-only status, and @@ -2052,6 +2052,11 @@ ffs_fhtovp(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp) vpp, 0)); } +/* + * Return a vnode from a mounted filesystem for inode with specified + * generation number. Return ESTALE if the inode with given generation + * number no longer exists on that filesystem. + */ int ffs_inotovp(struct mount *mp, ino_t ino, @@ -2067,7 +2072,6 @@ ffs_inotovp(struct mount *mp, struct cg *cgp; struct buf *bp; uint64_t cg; - int error; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -2082,9 +2086,8 @@ ffs_inotovp(struct mount *mp, */ if (fs->fs_magic == FS_UFS2_MAGIC) { cg = ino_to_cg(fs, ino); - error = ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp); - if (error != 0) - return (error); + if (ffs_getcg(fs, ump->um_devvp, cg, 0, &bp, &cgp) != 0) + return (ESTALE); if (ino >= cg * fs->fs_ipg + cgp->cg_initediblk) { brelse(bp); return (ESTALE); @@ -2092,9 +2095,8 @@ ffs_inotovp(struct mount *mp, brelse(bp); } - error = ffs_vgetf(mp, ino, lflags, &nvp, ffs_flags); - if (error != 0) - return (error); + if (ffs_vgetf(mp, ino, lflags, &nvp, ffs_flags) != 0) + return (ESTALE); ip = VTOI(nvp); if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {