From nobody Mon Feb 13 23:16:48 2023 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 4PG0bN5mLwz3qbx3; Mon, 13 Feb 2023 23:16:48 +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 4PG0bN39w4z3NLZ; Mon, 13 Feb 2023 23:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676330208; 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=TDCone7YiXp56d9Y4k+rF4wpqJtgY/eBS3bkHmewim4=; b=wZda15rk23n2e5LtrZn1c3iZKgQ0I0nVGKiXFktuiLDhNQUnLOlG+BjWjx1AJbvdEMYMjO Wpec3gI9h5Yu8vfeFNkUJ4SdrHOQTEjxX+1SmyN7qCeiiFqN+Pa7n+/uNixMBDvXrKbl2k crGUIqQ2hKiOPjHvrzDWvFdu4LwP3XKMBfdbCoYQPLlYoCammUDeXcALTzGSS3SYhFCOvi gtAPQC0IpAKkJnoLEHlpvqSBcXTjx5CbCOCB4eYuuB7uZ1JGgUlmcVLCtq7nXgF/JPqmeg FUJUPXD7CDFRBLrUz9WUWK3jOwHJjooqIQmDJqI86p5xj7ybZG34FkjCQYrdag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676330208; 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=TDCone7YiXp56d9Y4k+rF4wpqJtgY/eBS3bkHmewim4=; b=Sr7jDLmjrqmoNJ9tm4wYdw2KsKYHHsEN9k5YMApJAVfMltPOSN8XeZlY04UiAw3grcVVeb JkBzBx6SSU/ywV/ehtCyeoEZmJy4JwggFxIdEt7Tg9Jw4oourXkIViARiX/sJjTW3UJg3l YQ18Pnk/P8CM1gD1f4akxI0vLerMwzpJgdItmnB3zSGZCtaSILKMMula1d25AWoZUqCt6e tTkq6qF3yQxsGD+zIyLqk216mS3LYkOBRtqjCaupVpDSF1+Q6ko+66F7TZgYnUlEb2Za8c f0DLVoo0fi3yZr2QgV7w+yR/G1iLffGZX+Isr62hFmd1h8C6njEVMGD2efLDpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676330208; a=rsa-sha256; cv=none; b=RqkTCcE06LPf/DfTdN+tTWXfdtOTpf7NJwFd9RC81b4iBLDyYky67nMYP3LPIgn/GpVSWU vyj4LboWn3qivQkRjGxltTtNHHOfMQYijkAY1xh5u1dFkboM1qUDRQ5loJdLowKLRuGm80 AKWwwyZhZzpodq2cFcKZMcuPbY0brHN8veyyt9vN/cnJZBoTkFO8QrJDTkTnpmBz6aF4sC TDu7Zy3z4b7TpvixWtPPYQtHTyWEejEzmw/WUYGfJeQo21Q5a2EifM6ccMpyQxZz7DQU1t nYXMR9PL6+OLyf4+wNzmfi6a3dMFX9cFuTYg7e9lxdREtruwyqFv3XcQE8CVcw== 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 4PG0bN25dVzbpl; Mon, 13 Feb 2023 23:16:48 +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 31DNGms3044372; Mon, 13 Feb 2023 23:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31DNGmZw044371; Mon, 13 Feb 2023 23:16:48 GMT (envelope-from git) Date: Mon, 13 Feb 2023 23:16:48 GMT Message-Id: <202302132316.31DNGmZw044371@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: 3a3450eda6d4 - main - tmpfs_rename(): use tmpfs_access_locked instead of VOP_ACCESS() 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: 3a3450eda6d4616df51a30f84a872d9d43669d78 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a3450eda6d4616df51a30f84a872d9d43669d78 commit 3a3450eda6d4616df51a30f84a872d9d43669d78 Author: Konstantin Belousov AuthorDate: 2023-02-12 23:20:25 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-13 23:16:38 +0000 tmpfs_rename(): use tmpfs_access_locked instead of VOP_ACCESS() Protect the call with the node lock. We cannot lock the fvp vnode sleepable there, because we already own other participating vnode's locks. Taking it without sleeping require unwinding the whole locking state in one more place. Note that the liveness of the node is guaranteed by the lock on the parent directory vnode. Reported and tested by: pho Fixes: cbac1f3464956185cf95955344b6009e2cc3ae40ESC Reviewed by: markj, mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38557 --- sys/fs/tmpfs/tmpfs_vnops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index cd460636b647..b1d6bce6754f 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1129,7 +1129,10 @@ tmpfs_rename(struct vop_rename_args *v) if (de->td_node->tn_type == VDIR) { struct tmpfs_node *n; - error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread); + TMPFS_NODE_LOCK(fnode); + error = tmpfs_access_locked(fvp, fnode, VWRITE, + tcnp->cn_cred); + TMPFS_NODE_UNLOCK(fnode); if (error) { if (newname != NULL) free(newname, M_TMPFSNAME);