From nobody Mon Jan 31 14:53:11 2022 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 227081993E29; Mon, 31 Jan 2022 14:53:12 +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 4JnWJm0Bmrz4RZl; Mon, 31 Jan 2022 14:53:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643640792; 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=eQFfJLCbilYAN6UnZllbBIvHCmHFAKjg+wVH8qcPcNk=; b=Gg7QPlMkIfnKCejUlyuiLi2OC7hvgx3S6ljX34FrGWjOfAf9ceehQPOvpB4ZNUfdUwlWnI HxojQ+1PVJUpq//s/nuasgUbTOaov7Z4NE2YYWLCUdHjtbuCmphDyic+JA60pzH+iwnVvj tpxnlDNfsdrqrCcPNsCAgA97wLZ8qLMpOIKgclq9VRIi8nUeujSYPJ/54tXLaY+d7nm2R0 fhuLmn9JGlYlGQqnLZC0YC5GX/7lyt5mEPlpL7D1vZJVXqGTkB4gLmsLlnOhN42I5YSGY9 eR+GQ68MQldAKLx3q8tXCeowiVkzE/bcWb7N2KxnJPk/mEO4RFnUoRLDwMtgfw== 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 DC16C1E431; Mon, 31 Jan 2022 14:53:11 +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 20VErBoP081801; Mon, 31 Jan 2022 14:53:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20VErBDO081800; Mon, 31 Jan 2022 14:53:11 GMT (envelope-from git) Date: Mon, 31 Jan 2022 14:53:11 GMT Message-Id: <202201311453.20VErBDO081800@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 66c5fbca7719 - main - insmntque1(): remove useless arguments 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 66c5fbca7719dca1ac361a010fa511a4514a662d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643640792; 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=eQFfJLCbilYAN6UnZllbBIvHCmHFAKjg+wVH8qcPcNk=; b=JUJi3BiC4yiekP7Ii0p3lo6aMwnsECQtyOY6VeLEzA9QgWtg4sIFJo+KxLusBb6g+H0CSe FyDG2lZ2Zkt8d3R2ggsYwuA+TPhNdzhDQVBoQmn5RoJmK4g2uOlcSSSKXv7DUxbuHrd4Ka 93/vGydqEoRfrlS50qfNnVnMjUl2A7P09BbYoXsDI7pPQxw46xQ3LClbJtgwG/ooLDKa/W byLl784pIzDimXFlfbdAHGnEK4FIwlrkIYxYb+jTGQLtGxY5g0H4wN2QOq1PFMzi1PBsl6 HV0TM45a14q/yLdhEDxVaxEQBcu2bvpBm7z168gL8RPDP4wmL8JJeSD0NAolMg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643640792; a=rsa-sha256; cv=none; b=sSxmsL97aKKpYn/7xPEq5dCy5Er4L4biOwCqCm9DiIjXzQ46Df+76rTBEip64aaY9VEpzD Zh0icYc7z4cQT7EY+aQe9Kva8YtzMpFrZPR13CgziiLbWVqizeK1UAWfNmyesGB7JZ1Gmx +hGmEL329XHWH0AHhbOVY0JyxrkDxbD5OefqSkAHhEReuFvkzVv/5P05d67NOEIEZFoe+q QHqM3xq7pLB/nrdBpLONVW+7q/+utMuAuNrDXqbKQwZO4/vucQGaF1j/6BZQmjEl1PwR5s mNeT7HcSOYaxGDcMVkIvup3vuMLRop2B+43jtyOUDyZuz41zkJ6I0LG/ch4sKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=66c5fbca7719dca1ac361a010fa511a4514a662d commit 66c5fbca7719dca1ac361a010fa511a4514a662d Author: Konstantin Belousov AuthorDate: 2022-01-28 00:57:09 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-31 14:49:08 +0000 insmntque1(): remove useless arguments Also remove once-used functions to clean up after failed insmntque1(), which were destructor callbacks in previous life. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D34071 --- sys/fs/devfs/devfs_vnops.c | 21 +++++++-------------- sys/fs/fdescfs/fdesc_vnops.c | 2 +- sys/fs/nullfs/null_subr.c | 2 +- sys/fs/tmpfs/tmpfs_subr.c | 25 ++++++++----------------- sys/fs/unionfs/union_subr.c | 2 +- sys/kern/vfs_subr.c | 38 +++++++++++++++++++------------------- sys/sys/vnode.h | 3 +-- 7 files changed, 38 insertions(+), 55 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 38d581db9154..d003820d4a3a 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -507,18 +507,6 @@ devfs_allocv_drop_refs(int drop_dm_lock, struct devfs_mount *dmp, return (not_found); } -static void -devfs_insmntque_dtr(struct vnode *vp, struct devfs_dirent *de) -{ - - mtx_lock(&devfs_de_interlock); - vp->v_data = NULL; - de->de_vnode = NULL; - mtx_unlock(&devfs_de_interlock); - vgone(vp); - vput(vp); -} - /* * devfs_allocv shall be entered with dmp->dm_lock held, and it drops * it on return. @@ -615,9 +603,14 @@ loop: vp->v_data = de; de->de_vnode = vp; mtx_unlock(&devfs_de_interlock); - error = insmntque1(vp, mp, NULL, NULL); + error = insmntque1(vp, mp); if (error != 0) { - devfs_insmntque_dtr(vp, de); + mtx_lock(&devfs_de_interlock); + vp->v_data = NULL; + de->de_vnode = NULL; + mtx_unlock(&devfs_de_interlock); + vgone(vp); + vput(vp); (void) devfs_allocv_drop_refs(1, dmp, de); return (error); } diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 1dead8f1153c..2fbdcac34583 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -191,7 +191,7 @@ loop: fd->fd_ix = ix; if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF) vp->v_vflag |= VV_READLINK; - error = insmntque1(vp, mp, NULL, NULL); + error = insmntque1(vp, mp); if (error != 0) { vgone(vp); vput(vp); diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index acf77d5cfd47..6b422410b9ec 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -235,7 +235,7 @@ null_nodeget(struct mount *mp, struct vnode *lowervp, struct vnode **vpp) vp->v_type = lowervp->v_type; vp->v_data = xp; vp->v_vnlock = lowervp->v_vnlock; - error = insmntque1(vp, mp, NULL, NULL); + error = insmntque1(vp, mp); if (error != 0) { vput(lowervp); null_destroy_proto(vp, xp); diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index c6ac1b0bf357..a8f02c4284d2 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -822,21 +822,6 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) } } -/* - * Need to clear v_object for insmntque failure. - */ -static void -tmpfs_insmntque_dtr(struct vnode *vp) -{ - - tmpfs_destroy_vobject(vp, vp->v_object); - vp->v_object = NULL; - vp->v_data = NULL; - vp->v_op = &dead_vnodeops; - vgone(vp); - vput(vp); -} - /* * Allocates a new vnode for the node node or returns a new reference to * an existing one if the node had already a vnode referencing it. The @@ -983,9 +968,15 @@ loop: if (vp->v_type != VFIFO) VN_LOCK_ASHARE(vp); - error = insmntque1(vp, mp, NULL, NULL); + error = insmntque1(vp, mp); if (error != 0) { - tmpfs_insmntque_dtr(vp); + /* Need to clear v_object for insmntque failure. */ + tmpfs_destroy_vobject(vp, vp->v_object); + vp->v_object = NULL; + vp->v_data = NULL; + vp->v_op = &dead_vnodeops; + vgone(vp); + vput(vp); vp = NULL; } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 2b5754a560c7..557d4589df55 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -389,7 +389,7 @@ unionfs_nodeget(struct mount *mp, struct vnode *uppervp, ("%s: NULL dvp for non-root vp %p", __func__, vp)); vn_lock_pair(lowervp, false, uppervp, false); - error = insmntque1(vp, mp, NULL, NULL); + error = insmntque1(vp, mp); if (error != 0) { unionfs_nodeget_cleanup(vp, unp); return (error); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 839282fe318f..94748a4a4858 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1934,22 +1934,8 @@ delmntque(struct vnode *vp) MNT_IUNLOCK(mp); } -static void -insmntque_stddtr(struct vnode *vp, void *dtr_arg) -{ - - vp->v_data = NULL; - vp->v_op = &dead_vnodeops; - vgone(vp); - vput(vp); -} - -/* - * Insert into list of vnodes for the new mount point, if available. - */ -int -insmntque1(struct vnode *vp, struct mount *mp, - void (*dtr)(struct vnode *, void *), void *dtr_arg) +static int +insmntque1_int(struct vnode *vp, struct mount *mp, bool dtr) { KASSERT(vp->v_mount == NULL, @@ -1974,8 +1960,12 @@ insmntque1(struct vnode *vp, struct mount *mp, (vp->v_vflag & VV_FORCEINSMQ) == 0) { VI_UNLOCK(vp); MNT_IUNLOCK(mp); - if (dtr != NULL) - dtr(vp, dtr_arg); + if (dtr) { + vp->v_data = NULL; + vp->v_op = &dead_vnodeops; + vgone(vp); + vput(vp); + } return (EBUSY); } vp->v_mount = mp; @@ -1989,11 +1979,21 @@ insmntque1(struct vnode *vp, struct mount *mp, return (0); } +/* + * Insert into list of vnodes for the new mount point, if available. + * insmntque() reclaims the vnode on insertion failure, insmntque1() + * leaves handling of the vnode to the caller. + */ int insmntque(struct vnode *vp, struct mount *mp) { + return (insmntque1_int(vp, mp, true)); +} - return (insmntque1(vp, mp, insmntque_stddtr, NULL)); +int +insmntque1(struct vnode *vp, struct mount *mp) +{ + return (insmntque1_int(vp, mp, false)); } /* diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index a1dbdcff4cb5..6e8373379587 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -689,9 +689,8 @@ int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, struct vnode **vpp); void getnewvnode_reserve(void); void getnewvnode_drop_reserve(void); -int insmntque1(struct vnode *vp, struct mount *mp, - void (*dtr)(struct vnode *, void *), void *dtr_arg); int insmntque(struct vnode *vp, struct mount *mp); +int insmntque1(struct vnode *vp, struct mount *mp); u_quad_t init_va_filerev(void); int speedup_syncer(void); int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen);