From nobody Mon May 13 18:34:26 2024 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 4VdSnZ4ykhz5KlGf; Mon, 13 May 2024 18:34:26 +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 4VdSnZ3cx2z4X00; Mon, 13 May 2024 18:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715625266; 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=JMj+U5m9flTttEka21VGVbznynIkrrrOpzQsFzK6bFo=; b=U0K9u6yXKUxvHJR78X6ZPf5kQUrEeolyjWXzut+VNJsvq5qD34HXhTevx9UQZ82RTIklFH lzQKCEzxic1PGXKHSollA2d4YtNWv8F3c2Uq5NoHomiucyMlQ1njJTycPcr0soBn/dzkVa qT4pXKmXGHo13ydvGlq9p4Cu1KQmE2K+5a5clr08tqwRs47KfytIsxCS4IzR3GO+FsyVeV pZiFET12Sb3NOA7fc5+Ga/o78pS/9kyCJJbFER60yQyI89RR52vWflSHM0gNav0Xo1e7SU tySgWje6rTxAOTOh1WMwABsaJqYsfvYlnHyC0LqG1pbtvFPClVnK1q8GN3MMfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715625266; a=rsa-sha256; cv=none; b=kDiWjYGvnO7H74WEJCYFMxuGXnKJ2DOMtGTrwFVAfLfSRcCqtr3F5SHBmYALxyGMwkF9BL xq7gp0F2nlMmzWYVHgNLfa9xsPAN2zZme66WrD9ONIRVPQ7tAEwr4lTGAP2IBTeDRNGKNF G9mwxj7H1IIYHmepsUNmpElrS7RkdGgFmyggN21xKLiGRrlEYxrB6wegIn0Xbv9S8LP75c HzDfl0kpmaVurk4NUUQbg5rNv+CuNaTnrLfhx3qVkTtodMGCP4u6JCNiguGWxeRDo8S7Ks GxxCLVAyVE9m7bAmofnDLtQH9W2KJK97oHlPY9o1rj/KNUcQyNV9stjTefqV1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715625266; 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=JMj+U5m9flTttEka21VGVbznynIkrrrOpzQsFzK6bFo=; b=ki3xm3B8CZSl5kXTg3N7sTHCVoEactLxvJvonXKPGpIyFbVsPEJicZdLm+tfVhUn2tlIPL 7dAGSDkMUtI5kAx2PXVEBxsXR/tfsbeRb0576FM+cf9P6raF47MJqu3gnTsXbxabnIcwTR W7Csz2Fux5No0cGmqg/P6o/1RFEOHhZ4nRrQQP0x+yboyke8/QbxiB7l8Su2Ciwsdhwhn9 BTF4x/QzwKfEQq3JtrpYmMe4YcSbsIira+8NlI8rtNQTAELizlx7dSPk2IVlDqdwiDwJia /CUGRDA024zUXZTFaAxi/pkB0lNCP7dbGaOCNGoh+HueXRIIOh0Y1+TIPH8h+A== 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 4VdSnZ3Ck1z10Cx; Mon, 13 May 2024 18:34:26 +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 44DIYQLm050088; Mon, 13 May 2024 18:34:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44DIYQf8050085; Mon, 13 May 2024 18:34:26 GMT (envelope-from git) Date: Mon, 13 May 2024 18:34:26 GMT Message-Id: <202405131834.44DIYQf8050085@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: 46811949797b - main - tmpfs_destroy_vobject(): clear v_object under the object lock 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46811949797b7e44521cd56cfa61b6c8378c4600 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=46811949797b7e44521cd56cfa61b6c8378c4600 commit 46811949797b7e44521cd56cfa61b6c8378c4600 Author: Konstantin Belousov AuthorDate: 2024-05-12 01:26:32 +0000 Commit: Konstantin Belousov CommitDate: 2024-05-13 18:33:59 +0000 tmpfs_destroy_vobject(): clear v_object under the object lock Which allows tmpfs_pager_writecount_recalc() to reliably detect reclaimed vnode and make its accesses to object->un_pager.swp.private (== vp) safe against reclaim. Note that vnode instantiation already assigns v_object under the object lock. Reviewed by: markj Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45119 --- sys/fs/tmpfs/tmpfs_subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 4ddf2b4ba5ff..53781202b066 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -120,7 +120,7 @@ tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old, /* * Forced unmount? */ - if (vp == NULL) { + if (vp == NULL || vp->v_object == NULL) { KASSERT((object->flags & OBJ_TMPFS_VREF) == 0, ("object %p with OBJ_TMPFS_VREF but without vnode", object)); @@ -957,6 +957,8 @@ tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj) VM_OBJECT_WLOCK(obj); VI_LOCK(vp); + vp->v_object = NULL; + /* * May be going through forced unmount. */