From owner-dev-commits-src-main@freebsd.org Sat Oct 2 23:17:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 79F8B6AC05A; Sat, 2 Oct 2021 23:17:33 +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 4HMNDY30gtz3MlR; Sat, 2 Oct 2021 23:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 46B671BABE; Sat, 2 Oct 2021 23:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 192NHXif028065; Sat, 2 Oct 2021 23:17:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 192NHXTV028064; Sat, 2 Oct 2021 23:17:33 GMT (envelope-from git) Date: Sat, 2 Oct 2021 23:17:33 GMT Message-Id: <202110022317.192NHXTV028064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 9acea1640411 - main - ffs: retire unused fsckpid mount option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9acea16404117f2f54475640ff036c12130707d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2021 23:17:33 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=9acea16404117f2f54475640ff036c12130707d8 commit 9acea16404117f2f54475640ff036c12130707d8 Author: Robert Wing AuthorDate: 2021-10-02 23:11:40 +0000 Commit: Robert Wing CommitDate: 2021-10-02 23:11:40 +0000 ffs: retire unused fsckpid mount option The fsckpid mount option was introduced in 927a12ae16433b50 along with a couple sysctl's to support SU+J with snapshots. However, those sysctl's were never used and eventually removed in f2620e9ceb3ede02. There are no in-tree consumers of this mount option. Reviewed by: mckusick, kib Differential Revision: https://reviews.freebsd.org/D32015 --- sys/ufs/ffs/ffs_alloc.c | 3 +- sys/ufs/ffs/ffs_inode.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 117 ++--------------------------------------------- sys/ufs/ufs/ufsmount.h | 2 - 4 files changed, 6 insertions(+), 118 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 771377b7cefc..6a262a798d1b 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -3236,8 +3236,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) return (EINVAL); } ump = VFSTOUFS(mp); - if ((mp->mnt_flag & MNT_RDONLY) && - ump->um_fsckpid != td->td_proc->p_pid) { + if (mp->mnt_flag & MNT_RDONLY) { vn_finished_write(mp); fdrop(fp, td); return (EROFS); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 1159259fb2b6..17a9dceeb654 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -132,7 +132,7 @@ ffs_update(vp, waitfor) if (waitfor) ip->i_flag &= ~(IN_SIZEMOD | IN_IBLKDATA); fs = ITOFS(ip); - if (fs->fs_ronly && ITOUMP(ip)->um_fsckpid == 0) + if (fs->fs_ronly) return (0); /* * If we are updating a snapshot and another process is currently diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index fd3b2689c2ee..94afcae05ba6 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -147,7 +147,7 @@ static struct buf_ops ffs_ops = { */ static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "noclusterw", "noexec", "export", "force", "from", "groupquota", - "multilabel", "nfsv4acls", "fsckpid", "snapshot", "nosuid", "suiddir", + "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync", "union", "userquota", "untrusted", NULL }; static int ffs_enxio_enable = 1; @@ -347,7 +347,6 @@ ffs_mount(struct mount *mp) struct thread *td; struct ufsmount *ump = NULL; struct fs *fs; - pid_t fsckpid = 0; int error, error1, flags; uint64_t mntorflags, saved_mnt_flag; accmode_t accmode; @@ -395,31 +394,6 @@ ffs_mount(struct mount *mp) vfs_deleteopt(mp->mnt_opt, "snapshot"); } - if (vfs_getopt(mp->mnt_optnew, "fsckpid", NULL, NULL) == 0 && - vfs_scanopt(mp->mnt_optnew, "fsckpid", "%d", &fsckpid) == 1) { - /* - * Once we have set the restricted PID, do not - * persist "fsckpid" in the options list. - */ - vfs_deleteopt(mp->mnt_optnew, "fsckpid"); - vfs_deleteopt(mp->mnt_opt, "fsckpid"); - if (mp->mnt_flag & MNT_UPDATE) { - if (VFSTOUFS(mp)->um_fs->fs_ronly == 0 && - vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - } else if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) == 0) { - vfs_mount_error(mp, - "Checker enable: Must be read-only"); - return (EINVAL); - } - /* Set to -1 if we are done */ - if (fsckpid == 0) - fsckpid = -1; - } - if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) { if (mntorflags & MNT_ACLS) { vfs_mount_error(mp, @@ -443,18 +417,6 @@ ffs_mount(struct mount *mp) fs = ump->um_fs; odevvp = ump->um_odevvp; devvp = ump->um_devvp; - if (fsckpid == -1 && ump->um_fsckpid > 0) { - if ((error = ffs_flushfiles(mp, WRITECLOSE, td)) != 0 || - (error = ffs_sbupdate(ump, MNT_WAIT, 0)) != 0) - return (error); - g_topology_lock(); - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - g_topology_unlock(); - ump->um_fsckpid = 0; - } if (fs->fs_ronly == 0 && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { /* @@ -542,14 +504,6 @@ ffs_mount(struct mount *mp) return (error); if (fs->fs_ronly && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - /* - * If we are running a checker, do not allow upgrade. - */ - if (ump->um_fsckpid > 0) { - vfs_mount_error(mp, - "Active checker, cannot upgrade to write"); - return (EINVAL); - } /* * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. @@ -659,39 +613,6 @@ ffs_mount(struct mount *mp) mp->mnt_flag |= MNT_NFS4ACLS; MNT_IUNLOCK(mp); } - /* - * If this is a request from fsck to clean up the filesystem, - * then allow the specified pid to proceed. - */ - if (fsckpid > 0) { - if (ump->um_fsckpid != 0) { - vfs_mount_error(mp, - "Active checker already running on %s", - fs->fs_fsmnt); - return (EINVAL); - } - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - vfs_mount_error(mp, - "Checker activation failed on %s", - fs->fs_fsmnt); - return (error); - } - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_fmod = 1; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } /* * If this is a snapshot request, take the snapshot. @@ -771,29 +692,6 @@ ffs_mount(struct mount *mp) vrele(devvp); return (error); } - if (fsckpid > 0) { - KASSERT(MOUNTEDSOFTDEP(mp) == 0, - ("soft updates enabled on read-only file system")); - ump = VFSTOUFS(mp); - fs = ump->um_fs; - g_topology_lock(); - /* - * Request write access. - */ - error = g_access(ump->um_cp, 0, 1, 0); - g_topology_unlock(); - if (error) { - printf("WARNING: %s: Checker activation " - "failed\n", fs->fs_fsmnt); - } else { - ump->um_fsckpid = fsckpid; - if (fs->fs_snapinum[0] != 0) - ffs_snapshot_mount(mp); - fs->fs_mtime = time_second; - fs->fs_clean = 0; - (void) ffs_sbupdate(ump, MNT_WAIT, 0); - } - } } MNT_ILOCK(mp); @@ -1510,7 +1408,7 @@ ffs_unmount(mp, mntflags) if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); MPASS(ump->um_softdep == NULL); - if (fs->fs_ronly == 0 || ump->um_fsckpid > 0) { + if (fs->fs_ronly == 0) { fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1; error = ffs_sbupdate(ump, MNT_WAIT, 0); if (ffs_fsfail_cleanup(ump, error)) @@ -1530,13 +1428,6 @@ ffs_unmount(mp, mntflags) free (ump->um_trimhash, M_TRIM); } g_topology_lock(); - if (ump->um_fsckpid > 0) { - /* - * Return to normal read-only mode. - */ - error = g_access(ump->um_cp, 0, -1, 0); - ump->um_fsckpid = 0; - } g_vfs_close(ump->um_cp); g_topology_unlock(); BO_LOCK(&ump->um_odevvp->v_bufobj); @@ -1800,7 +1691,7 @@ ffs_sync(mp, waitfor) suspended = 0; td = curthread; fs = ump->um_fs; - if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) + if (fs->fs_fmod != 0 && fs->fs_ronly != 0) panic("%s: ffs_sync: modification on read-only filesystem", fs->fs_fsmnt); if (waitfor == MNT_LAZY) { @@ -2272,7 +2163,7 @@ ffs_sbupdate(ump, waitfor, suspended) fs = ump->um_fs; if (fs->fs_ronly == 1 && (ump->um_mountp->mnt_flag & (MNT_RDONLY | MNT_UPDATE)) != - (MNT_RDONLY | MNT_UPDATE) && ump->um_fsckpid == 0) + (MNT_RDONLY | MNT_UPDATE)) panic("ffs_sbupdate: write read-only filesystem"); /* * We use the superblock's buf to serialize calls to ffs_sbupdate(). diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index da9a22127125..a1a2cdb3f741 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -82,7 +82,6 @@ LIST_HEAD(trimlist_hashhead, ffs_blkfree_trim_params); * i - ufsmount interlock (UFS_LOCK / UFS_UNLOCK) * q - associated quota file is locked * r - ref to parent mount structure is held (vfs_busy / vfs_unbusy) - * u - managed by user process fsck_ufs */ struct ufsmount { struct mount *um_mountp; /* (r) filesystem vfs struct */ @@ -102,7 +101,6 @@ struct ufsmount { struct mtx um_lock; /* (c) Protects ufsmount & fs */ struct sx um_checkpath_lock; /* (c) Protects ufs_checkpath() result */ - pid_t um_fsckpid; /* (u) PID can do fsck sysctl */ struct mount_softdeps *um_softdep; /* (c) softdep mgmt structure */ struct vnode *um_quotas[MAXQUOTAS]; /* (q) pointer to quota files */ struct ucred *um_cred[MAXQUOTAS]; /* (q) quota file access cred */