From nobody Fri Oct 03 19:22:18 2025 X-Original-To: dev-commits-src-main@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 4cddpL5b5jz690Bh; Fri, 03 Oct 2025 19:22:18 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cddpL4rttz3hdQ; Fri, 03 Oct 2025 19:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759519338; 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=TFkIV3f8v0Yo+IzK5YAF+9sesOp0GFWZuJvRyfblpUU=; b=g4mkGwETzqM9C2GekVvurZUp8CUrYRi5c9oRZB7kIlc8+aLcw47qyjuohTdy43VX2p8J44 UzpfcpOgrR91t5KSBhoJgMIfetLUqBmaAbedt8KpUjYG2sP/CbckonYy49J5CdnQCe1Bwp 2zHIoizvkaXWnV8z1CzxcY6+aUPbl1ogZBdpAWnkHRNBuu72z/v9MwQtOtFL08Tvi74EOI OnT2LtB1h/3iD8jhYaHnRLOiUQvF8R2Jg4Q6EwtWAJG1jtPyJBozRYIj7Jad/qfCS2cvCZ qioDYFz/swXHrwyRZ4MIDXjmyv8i8pyby6SiFU1zbLtvzWEpze1IabaV/niGqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759519338; 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=TFkIV3f8v0Yo+IzK5YAF+9sesOp0GFWZuJvRyfblpUU=; b=pJfQyaVblkYa7tZYSIeuaeKnnGuUzLZ0k9+etdCXWjdSqA9E6dwHtfxx2wh3d7Eug6vdAZ 4uOPcHDtkmMBp91kxytNxzbFbIOs8QkwY2jJkWim63KbOq4wCCXerwfjUBhhDboPn2dRxb 3V6ebNYvweFDqPE1KG9tRvagp3aKfitGGXrFcfuRFAJZeWhMbEANgLUo05C8XLqwopj2q2 P0EF7YK6xSqsYVqDxDefBemblkx/fSK9NJrrS+sZAC5ZHwDmYEnOZbZUOUAKmpMzhSE5cr c0ao43ZPgpOog7fI6vabgqtdRu1HFTH2rBkAIr7YQEUNkBeoSH2o5rQhjGEhMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759519338; a=rsa-sha256; cv=none; b=KFc+qWhSlsLZ9H51FS64rxnSrS/Sc5bKbdA8bheC+gBVH9TE+CoZe10KvE6rA2/eo3AKvi 19onJLOSJqzdHpqHWxPUQ1SnixN/RGTGX1XttOPCn0HhPNE9Kr1cIsU+TKtpQ3A9Z/Qn2B 00bwdiG2OhDu6d684+tZ003PcHJdlwnZCHqQCodeQ/9bzhNpJivSYEJetNAbqp53Wx0Zr6 JBG52888gb7Zip38R0zHfmC+qXATLBYMFyyfQuoR9mc90qLGf0zWVoQnuEl8fXAAaIxSwE Vkg+dzwibdvKpmlrP91bloUFsOLWGaBrZOjOsNT4B/gB0ak30cU8fmXfRNvQdw== 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 4cddpL485nz16dt; Fri, 03 Oct 2025 19:22:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 593JMIEA047302; Fri, 3 Oct 2025 19:22:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 593JMIgN047299; Fri, 3 Oct 2025 19:22:18 GMT (envelope-from git) Date: Fri, 3 Oct 2025 19:22:18 GMT Message-Id: <202510031922.593JMIgN047299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 94aae0513896 - main - nullfs: remove the vhold/vdrop cycle around unlock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94aae0513896de398a1feda6cd97f7efa2a5dc2e Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=94aae0513896de398a1feda6cd97f7efa2a5dc2e commit 94aae0513896de398a1feda6cd97f7efa2a5dc2e Author: Mateusz Guzik AuthorDate: 2025-10-01 11:09:50 +0000 Commit: Mateusz Guzik CommitDate: 2025-10-03 19:14:30 +0000 nullfs: remove the vhold/vdrop cycle around unlock Both lower vnode and null data are safe while the lock is held, at the same time neither is touched after unlock. While here remove stale comment about interlock handling. It is no longer legal to pass to unlock. Reviewed by: kib Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D38761 --- sys/fs/nullfs/null_vnops.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index e9d598014a2f..64e5b004abca 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -840,11 +840,6 @@ null_lock(struct vop_lock1_args *ap) return (error); } -/* - * We need to process our own vnode unlock and then clear the - * interlock flag as it applies only to our vnode, not the - * vnodes below us on the stack. - */ static int null_unlock(struct vop_unlock_args *ap) { @@ -853,11 +848,20 @@ null_unlock(struct vop_unlock_args *ap) struct vnode *lvp; int error; + /* + * Contrary to null_lock, we don't need to hold the vnode around + * unlock. + * + * We hold the lock, which means we can't be racing against vgone. + * + * At the same time VOP_UNLOCK promises to not touch anything after + * it finishes unlock, just like we don't. + * + * vop_stdunlock for a doomed vnode matches doomed locking in null_lock. + */ nn = VTONULL(vp); if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) { - vholdnz(lvp); error = VOP_UNLOCK(lvp); - vdrop(lvp); } else { error = vop_stdunlock(ap); }