From nobody Sat Feb 11 03:36:00 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 4PDGTs0H8nz3pk4T; Sat, 11 Feb 2023 03:36:01 +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 4PDGTr6pVmz3JVp; Sat, 11 Feb 2023 03:36:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676086561; 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=rCndJPVF/kDUvEWJdOp0gQqa2TyVabNZ2c3Evj9NvAo=; b=mR4C+KsFoJMSFjH5RlPMG50H5n86X328ZaWeW8vjeq6TwvxFZzZ2pmsh4tuOK4xbm7niv8 xSeGjSaSOLU/y3hBg09O6yXpi7rrUaRODStf/CZUPweAQCiJ4laq6Vpc1EgmA0jKf7aNSw 5HET42d75C+gUPd+jJeuAhc/CAqjRT/VLFFEIEaiBG8/anOpSVcra+/oehmymIGVBPgm/4 F89R1yk4mbehAfwtbWuD328AjEI0Vbo/Y11/UDBqNGEaMTSP+2hhWycSL2dCBWA4yOPbTj crFhJJad4T/o/Pp/W40JHnN8KOaF0Hg4mj4ttdytaBMUvqnBdwtpGrr5z4dcvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676086561; 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=rCndJPVF/kDUvEWJdOp0gQqa2TyVabNZ2c3Evj9NvAo=; b=QGRBMeGp9sDzFMBAdG5WLuQNwKSYJLabblfHW2myU3EvyNpcMgxD79jFw1z/5JrJv/iuPi 8aaUmooDLM5KUBFd7UDG6AFojvpGK/pnR8wrL522soaziB6L+HtKYqAIsUAvU2N5DWAdAP DwGEezCkiNU7Q4WvYf1qbzQ1IhWyY/HnYpAoLTrcgJ+bBwktBSgebXyRUivVd41yFqQq5e Z7vT3066UntunH/0s83gspTrdR/OCMajbPmtDmmnzhz7T+2rGWoJvCE8890fz4OZPklkb1 mit8KtrggQHVzokmdRsceV7s/BqhOyvoFN0Bykz2GUtnyKjrAtvsIss9xOSE7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676086561; a=rsa-sha256; cv=none; b=bTJzUeZ0x7g3MFN1XyYpmOAhzyZqNZzEp9MgpzoweFGYMaR48YWl+kOqa0lnSiMVPL/N0z GdEQP43+azSRQNhZpE7AoB08FO0hQ6xaa689YIrzJEJJrPO44BCwOjaQVtaAisTK8F6DxF XrjVujbhqTsorjA6lbbzidt5i9XqhYWArFizQ8ru8a74FZfE+ULydzlxt8idTaP6/ZH/yr lS0bhJR92QQkMrC8vqnSbjSAK4crflFA9/naHrjfdP7PXBOhHhD7qb60HpiS0cTDi9at/M f75PwZrrYDCx/fH56Ro1+1JgIK9fyQBbPlXMYxqv0n+QIfLhv5sMk5DayP9H1w== 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 4PDGTr5lnGzkQG; Sat, 11 Feb 2023 03:36:00 +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 31B3a0CV047401; Sat, 11 Feb 2023 03:36:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31B3a04F047400; Sat, 11 Feb 2023 03:36:00 GMT (envelope-from git) Date: Sat, 11 Feb 2023 03:36:00 GMT Message-Id: <202302110336.31B3a04F047400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 3e230e0cc4ad - main - nfsd: Fix handling of the error case for nfsvno_open some more 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: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e230e0cc4ad822554afaaa07369ca5ccb62054d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3e230e0cc4ad822554afaaa07369ca5ccb62054d commit 3e230e0cc4ad822554afaaa07369ca5ccb62054d Author: Rick Macklem AuthorDate: 2023-02-11 03:34:57 +0000 Commit: Rick Macklem CommitDate: 2023-02-11 03:34:57 +0000 nfsd: Fix handling of the error case for nfsvno_open some more Commit ded5f2954e1a defined done_namei to indicate that nd_repstat was set after a successful nfsvno_namei(), so that a cleanup needs to be done in nfsvno_open(). However, it missed the case where a call to nfsrv_opencheck() in nfsvno_open() sets nd_repstat non-zero. This would cause panics due to a dangling locked vnode when nfsrv_opencheck() set nd_repstat, such as during grace just after a server boot. This patch fixes the problem. PR: 268971 --- sys/fs/nfsserver/nfs_nfsdport.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 7305ae6a84fe..daa57222fe22 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1842,10 +1842,19 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp, u_quad_t tempsize; struct nfsexstuff nes; struct thread *p = curthread; + uint32_t oldrepstat; - if (ndp->ni_vp == NULL) + if (ndp->ni_vp == NULL) { + /* + * If nfsrv_opencheck() sets nd_repstat, done_namei needs to be + * set true, since cleanup after nfsvno_namei() is needed. + */ + oldrepstat = nd->nd_repstat; nd->nd_repstat = nfsrv_opencheck(clientid, stateidp, stp, NULL, nd, p, nd->nd_repstat); + if (nd->nd_repstat != 0 && oldrepstat == 0) + done_namei = true; + } if (!nd->nd_repstat) { if (ndp->ni_vp == NULL) { nd->nd_repstat = VOP_CREATE(ndp->ni_dvp,