Date: Sun, 20 Aug 2023 04:28:25 GMT From: Kirk McKusick <mckusick@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c1854e43b352 - stable/13 - Clean up and document UFS/FFS error returns. Message-ID: <202308200428.37K4SPr7033651@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c1854e43b352d7b3fe3a861302d18d729cf8dced commit c1854e43b352d7b3fe3a861302d18d729cf8dced Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2023-08-11 00:50:23 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2023-08-20 04:27:38 +0000 Clean up and document UFS/FFS error returns. Sponsored-by: The FreeBSD Foundation (cherry picked from commit 886fd36e1ac2082f1b0decb89d70e1e7a0dc3043) --- 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 23d0c9bc60df..bdb3fadb84ea 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -820,7 +820,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 @@ -2079,6 +2079,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, @@ -2094,7 +2099,6 @@ ffs_inotovp(struct mount *mp, struct cg *cgp; struct buf *bp; uint64_t cg; - int error; ump = VFSTOUFS(mp); fs = ump->um_fs; @@ -2109,9 +2113,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); @@ -2119,9 +2122,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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202308200428.37K4SPr7033651>