From owner-svn-src-stable-11@freebsd.org Tue Nov 6 14:21:27 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BD071125652; Tue, 6 Nov 2018 14:21:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22982791B7; Tue, 6 Nov 2018 14:21:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEC3527CE6; Tue, 6 Nov 2018 14:21:26 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA6ELQhg068398; Tue, 6 Nov 2018 14:21:26 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA6ELQks068397; Tue, 6 Nov 2018 14:21:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201811061421.wA6ELQks068397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 6 Nov 2018 14:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r340183 - stable/11/sys/fs/nfsserver X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/fs/nfsserver X-SVN-Commit-Revision: 340183 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 22982791B7 X-Spamd-Result: default: False [-103.10 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.995,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-1.00)[-0.996,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Nov 2018 14:21:27 -0000 Author: avg Date: Tue Nov 6 14:21:26 2018 New Revision: 340183 URL: https://svnweb.freebsd.org/changeset/base/340183 Log: MFC r339595: nfsrvd_readdirplus: for some errors, do not fail the entire request Sponsored by: Panzura Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/11/sys/fs/nfsserver/nfs_nfsdport.c Tue Nov 6 13:54:24 2018 (r340182) +++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c Tue Nov 6 14:21:26 2018 (r340183) @@ -2150,10 +2150,22 @@ again: } } } - if (!r) { - if (refp == NULL && - ((nd->nd_flag & ND_NFSV3) || - NFSNONZERO_ATTRBIT(&attrbits))) { + + /* + * If we failed to look up the entry, then it + * has become invalid, most likely removed. + */ + if (r != 0) { + if (needs_unbusy) + vfs_unbusy(new_mp); + goto invalid; + } + KASSERT(refp != NULL || nvp != NULL, + ("%s: undetected lookup error", __func__)); + + if (refp == NULL && + ((nd->nd_flag & ND_NFSV3) || + NFSNONZERO_ATTRBIT(&attrbits))) { r = nfsvno_getfh(nvp, &nfh, p); if (!r) r = nfsvno_getattr(nvp, nvap, @@ -2174,17 +2186,25 @@ again: if (new_mp == mp) new_mp = nvp->v_mount; } - } - } else { - nvp = NULL; } - if (r) { + + /* + * If we failed to get attributes of the entry, + * then just skip it for NFSv3 (the traditional + * behavior in the old NFS server). + * For NFSv4 the behavior is controlled by + * RDATTRERROR: we either ignore the error or + * fail the request. + * Note that RDATTRERROR is never set for NFSv3. + */ + if (r != 0) { if (!NFSISSET_ATTRBIT(&attrbits, NFSATTRBIT_RDATTRERROR)) { - if (nvp != NULL) - vput(nvp); + vput(nvp); if (needs_unbusy != 0) vfs_unbusy(new_mp); + if ((nd->nd_flag & ND_NFSV3)) + goto invalid; nd->nd_repstat = r; break; } @@ -2253,6 +2273,7 @@ again: if (dirlen <= cnt) entrycnt++; } +invalid: cpos += dp->d_reclen; dp = (struct dirent *)cpos; cookiep++;