From nobody Thu Apr 06 18:04:30 2023 X-Original-To: dev-commits-src-branches@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 4PsqC26wpdz44fZ4; Thu, 6 Apr 2023 18:04:30 +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 4PsqC24dtnz3QmG; Thu, 6 Apr 2023 18:04:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680804270; 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=MCdvQXWeBz8mDommawTXe1NvDHka+mkm+D0Seu7la+g=; b=bpvj0J45hRW/pgkt1luKAdoreGgf9JOQeWDg4GazFFa9MZxiRTw5oZYhyfeltOFJVyeiTa vFeobSu4t8EWCS8G/AYwN6qhH//wl1n8GzILGOLwSEgFzHWhxGFuZXhtFyo/QNRs9p7hrl kJj88S26tK3ODFnwnMBWdOC13G9LZdNABVbYx5r9dc230XURdgUrNhiQJN70F7+3Sg+LV3 VYvwlDFcIZvv6Lz9GifANPVWHIMJfbzfZMTPqpvzGw8vrnF0UQ0Rln7U0mn4eISNVIOFMm rL+kCmGLqQOrWcrx+IqcLheAdFhvUB6sd07qtmPcu6Xygp1S7oj3h9tlZ05jJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680804270; 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=MCdvQXWeBz8mDommawTXe1NvDHka+mkm+D0Seu7la+g=; b=qxEjlVBgOyefYOI+T0r2iAxEcpZunWAmaf4tHud69X6FFTktT4NZJgXdrq0wl/TYE+mnSp Ly9CB7XEjqBGfsif7EZH9pe+AvBUG6ETYD1LOryLdpN4/FBsUo0w4Jaf7VL8lFg/nie4pG jm4A8cD2MczkG2g4VrmTaFse5ytN11lJZTcgpI1kIMlr3CUdE0Aeiqh3vfdHpHI6cxfGgQ VE7XVYhbGC+eNrDdUrTuMopJI+wUDebwLAyBwFDx+I6LL96NuSW+OGc57ycQH506ivuyOC jTz8NwgD1RfrV2uHCBfS7Bgl472m2VnQO/a45PlHtyrcp1IGXfefnAloXVudlg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680804270; a=rsa-sha256; cv=none; b=LM8utH+IHPNXYvGlfTMdXUfiy31k9VT2kGwUyxKZNHjM+/3SApBGJMs5wrOuxKP2LmUWuR LhrQvwYoQYsbg5x+PbyHL6/83HBzaepNu1FHZGCD/xGWgW6plujGb5AFPxZtRTwwQUJxbR dIlpqmsgkxS84VbJn4DLY9b1u/reld6GZYS4uKa7SiPJ2eScALIXyl7RT76kMn1YFwZHv/ gv5+xFgmYmpoMM/44iJgDlObgQ81w2qHE3vv93DS70FYoEhh5bsosjdCF4ia8RzM1MKFsw 7fMBx6vN9P9kQ6ICQAvIo+dTOFcUg4ITfe8qMzSAQWQQP38gbcOC6wQuqYYTKA== 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 4PsqC23fMGzDvp; Thu, 6 Apr 2023 18:04:30 +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 336I4UXi010703; Thu, 6 Apr 2023 18:04:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 336I4UMt010702; Thu, 6 Apr 2023 18:04:30 GMT (envelope-from git) Date: Thu, 6 Apr 2023 18:04:30 GMT Message-Id: <202304061804.336I4UMt010702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c5adb35ede60 - stable/13 - fdesc_lookup(): the condition to use vn_vget_ino() is always true List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: c5adb35ede6018f56697dcf9f30f701922fe3ca0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c5adb35ede6018f56697dcf9f30f701922fe3ca0 commit c5adb35ede6018f56697dcf9f30f701922fe3ca0 Author: Konstantin Belousov AuthorDate: 2023-03-23 19:28:08 +0000 Commit: Konstantin Belousov CommitDate: 2023-04-06 18:04:10 +0000 fdesc_lookup(): the condition to use vn_vget_ino() is always true (cherry picked from commit 7dca8fd1cb3f91e7a3c07b7f57af6d9d43d0c71c) --- sys/fs/fdescfs/fdesc_vnops.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index ae52ef5c3bea..e8aa9f81dc2e 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -348,26 +348,24 @@ fdesc_lookup(struct vop_lookup_args *ap) goto bad; fdropped = false; - /* Make sure we're not looking up the dvp itself. */ - if (VTOFDESC(dvp)->fd_ix != FD_DESC + fd) { - /* - * Unlock our root node (dvp) when doing this, since we might - * deadlock since the vnode might be locked by another thread - * and the root vnode lock will be obtained afterwards (in case - * we're looking up the fd of the root vnode), which will be the - * opposite lock order. Vhold the root vnode first so we don't - * lose it. - */ - arg.ftype = Fdesc; - arg.fd_fd = fd; - arg.ix = FD_DESC + fd; - arg.fp = fp; - arg.td = td; - arg.fdropped = fdropped; - error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, - LK_EXCLUSIVE, &fvp); - fdropped = arg.fdropped; - } + /* + * Make sure we do not deadlock looking up the dvp itself. + * + * Unlock our root node (dvp) when doing this, since we might + * deadlock since the vnode might be locked by another thread + * and the root vnode lock will be obtained afterwards (in case + * we're looking up the fd of the root vnode), which will be the + * opposite lock order. + */ + arg.ftype = Fdesc; + arg.fd_fd = fd; + arg.ix = FD_DESC + fd; + arg.fp = fp; + arg.td = td; + arg.fdropped = fdropped; + error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, &arg, + LK_EXCLUSIVE, &fvp); + fdropped = arg.fdropped; if (!fdropped) { /*