From nobody Fri Feb 04 23:31:41 2022 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 E8BE219AECF3; Fri, 4 Feb 2022 23:31:41 +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 4JrBd96GgNz4gK6; Fri, 4 Feb 2022 23:31:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644017501; 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=GNeMRRgOVMnEkWB8LC5Mm7IPNEeOG04VRgH0ijiZ3a4=; b=CgKIvgo1ozPEQoKcjjhcHJO7sDOu+yWfrveXueR+HMrYsVbhAS0YxAR8rsK9oqaMwyVIJI uRq6WEYEjJluLs0CwLLXrG6/6ugITNBDmrhrTKIyK5Dt/eLmGjufBkBFWhvU6b51bw40AJ qqfj+PVCCxJlrZat8lc7DuMWqQbbvv+Snm39zXioDmEIKe8QW4+GBDbH+/vxF15SmRFj8R 78uap4ueyICVJJKFO7ucoSD90CNjRlCcSasQgWxjp4Y7ElhCf7bRlPjOliVkCTd9S2tn29 hfzAiihVk+kSpcuUCiMaxlCiD+gBhSHXT/1HgECiU4Jozvcn9TjOh11/vo6kAw== 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 B7D0B1497C; Fri, 4 Feb 2022 23:31:41 +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 214NVfq0082657; Fri, 4 Feb 2022 23:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 214NVfeB082656; Fri, 4 Feb 2022 23:31:41 GMT (envelope-from git) Date: Fri, 4 Feb 2022 23:31:41 GMT Message-Id: <202202042331.214NVfeB082656@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: d088dc76e1a6 - main - Fix NFS exports of FUSE file systems for big directories 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: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d088dc76e1a62ecb6c05bd2b14ee48a9f9a7e2bd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644017501; 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=GNeMRRgOVMnEkWB8LC5Mm7IPNEeOG04VRgH0ijiZ3a4=; b=ODr3afzz23hueePNSJQpszTqeI259nH4g9q2TpbCW1PRnmzhypJgNkerd8DNdSU0Vn6qG8 RMzinC7UhxEUmc73JD7pnlAYykN884b1F7FyffiAAmvRRHHML8+w6kK5jWIRnJy6Vp/RQv puN91sA/ax1xCap3vOg8V/7Sg2viEDW2yJ22dihnyk9QCKMhM6Xw8NCXMoh05UaiDkMbEe e5o0GaNFCgN7u1FK98V9+BGpli879drl1YoEfe+dTUmd1CQG0Yg+9Oa3mH+uTeuO1qlW8H lhxJutxJMqtfWwBCD/3XtV5u8GN6l983btWyRsOhwB88NULhCdjHqDgkVgdqAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644017501; a=rsa-sha256; cv=none; b=w6s04pjYUoNkV4KClDu1LXqMDf53qstMxcFL1D2v3otkI6Bt+5TlqNFeqjEmINBhEqZaT/ 3g5xyxheiguSp4kr5oodl+UtzswQfNZB/keX5Yg7Ud8Au2s59HEC0cvqrUOwDaEj8bO38z hHZOSkpfJxTtjNmV03/kIFNN7oXFOKLi1wd0cjePuClabLFixrSYfJCPT/8lpAWdScodiD U1IspVx4ust7za0xd/r5qIaGkp1gUx8pnNO/ExZkQdo++GE0K5cEaYMap4F4wG+yL80LUi 8tdkMnNYibjF6VBEaR2W9/jOhFkNPdDUNyxH36RE/kCg/55mfejilFQZ29FR2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=d088dc76e1a62ecb6c05bd2b14ee48a9f9a7e2bd commit d088dc76e1a62ecb6c05bd2b14ee48a9f9a7e2bd Author: Alan Somers AuthorDate: 2022-01-02 17:18:47 +0000 Commit: Alan Somers CommitDate: 2022-02-04 23:30:49 +0000 Fix NFS exports of FUSE file systems for big directories The FUSE protocol does not require that a directory entry's d_off field outlive the lifetime of its directory's file handle. Since the NFS server must reopen the directory on every VOP_READDIR call, that means it can't pass uio->uio_offset down to the FUSE server. Instead, it must read the directory from 0 each time. It may need to issue multiple FUSE_READDIR operations until it finds the d_off field that it's looking for. That was the intention behind SVN r348209 and r297887, but a logic bug prevented subsequent FUSE_READDIR operations from ever being issued, rendering large directories incompletely browseable. MFC after: 3 weeks Reviewed by: rmacklem --- sys/fs/fuse/fuse_internal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 273b4f5b8522..eb8f1f87d90f 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -586,11 +586,7 @@ fuse_internal_readdir(struct vnode *vp, fnd_start = 1; while (uio_resid(uio) > 0) { fdi.iosize = sizeof(*fri); - if (fri == NULL) - fdisp_make_vp(&fdi, FUSE_READDIR, vp, NULL, NULL); - else - fdisp_refresh_vp(&fdi, FUSE_READDIR, vp, NULL, NULL); - + fdisp_make_vp(&fdi, FUSE_READDIR, vp, NULL, NULL); fri = fdi.indata; fri->fh = fufh->fh_id; fri->offset = uio_offset(uio); @@ -628,6 +624,8 @@ fuse_internal_readdir_processdata(struct uio *uio, int err = 0; int oreclen; size_t freclen; + int ents_copied = 0; + int ents_seen = 0; struct dirent *de; struct fuse_dirent *fudge; @@ -638,7 +636,7 @@ fuse_internal_readdir_processdata(struct uio *uio, return -1; for (;;) { if (bufsize < FUSE_NAME_OFFSET) { - err = -1; + err = (ents_seen == 0 || ents_copied > 0) ? -1 : 0; break; } fudge = (struct fuse_dirent *)buf; @@ -649,7 +647,7 @@ fuse_internal_readdir_processdata(struct uio *uio, * This indicates a partial directory entry at the * end of the directory data. */ - err = -1; + err = (ents_seen == 0 || ents_copied > 0) ? -1 : 0; break; } #ifdef ZERO_PAD_INCOMPLETE_BUFS @@ -671,6 +669,7 @@ fuse_internal_readdir_processdata(struct uio *uio, err = -1; break; } + ents_seen++; /* * Don't start to copy the directory entries out until * the requested offset in the directory is found. @@ -702,6 +701,7 @@ fuse_internal_readdir_processdata(struct uio *uio, cookies++; (*ncookies)--; } + ents_copied++; } else if (startoff == fudge->off) *fnd_start = 1; buf = (char *)buf + freclen;