Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2094567pxb; Sat, 21 Nov 2020 08:35:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYcMoTba6H2kgGtTuKqFpOvOdVunQDrEJE3oLDqGIA6Xdjn4tldlriapkcqP4k/I0tlTpY X-Received: by 2002:a17:906:3ad5:: with SMTP id z21mr11538651ejd.35.1605976532717; Sat, 21 Nov 2020 08:35:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605976532; cv=none; d=google.com; s=arc-20160816; b=Gi56o17feYjzNQICFcS0MFYSARyHgYKR/xEWQRWoCHgxXgHH4DqGsmyHgM/zfCaNGV Mzhs9LYIuMGdozMj9/giJbSfxCmRn8v8dmL4lYKEaKF9grNKl0EEl2xGgqJ29vV8x0Cg SZwiApDEj8SA18Ltcl2EMTAfnBRQZnEHz5xJkU5I9GURx6HyUXLPONNCtOrXeRukNuh5 ZuQ12BxQvJowY1G3Gfwk2BiF+os3Aairkzzff4IdeCp5AhGfSaNgz0nN0uQyZ3UhfMVA wP6W7D3ajlyunfNCCbnX0h0xDyKE5pP3f1vEcNUaUKqrAJEw73wIrPwFtUd23bczEu3n HYmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=0GCWgxUOGcvHQW2nwo/evhnFBjuuEz/w87gHOrU4v9w=; b=c1Z2H26Pp5xwCs3pvZ4E/hfyBlHfqwo1QY2lPzf4AfAqMez2liSem+9DRsGhCUn4ez qXjkokOwaz1LC1B+CGDgsh5J9XSzaMliswCRhFDCtWVeQiFzbPq0SPGxzueAh2SzHVtT EcSG1Uk/QMPc0QlFQTGov/N0gVSzvwq0ZPzkobmc8TonsfSFP8eeQZPsjc5gtEmKPI4Q iqWY+DSfGSmHVaXqKgHLSRn0pH+bOKTVPyX2Wz94jRe1B3r2ngWqwX/W83sPhsuwlsb0 z/hkAMG9aQNMBWX2PiDHuB4j05hq2Ty26nQnP5KC5Dmf5Ko6OJZrYBcMY2y45rLso3Fa AUOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=GQClriDd; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si3918240edw.47.2020.11.21.08.35.03; Sat, 21 Nov 2020 08:35:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=GQClriDd; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgKUQcw (ORCPT + 99 others); Sat, 21 Nov 2020 11:32:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgKUQcw (ORCPT ); Sat, 21 Nov 2020 11:32:52 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE417C0613CF for ; Sat, 21 Nov 2020 08:32:51 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id 07F166E9D; Sat, 21 Nov 2020 11:32:51 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 07F166E9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1605976371; bh=0GCWgxUOGcvHQW2nwo/evhnFBjuuEz/w87gHOrU4v9w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GQClriDdgxYMAVVIjH+gzigdg2fjftySo/GncGHSPHoUrDwehFt/9pUrRMrlNUQbY kNBAjSD3nq5pQuDXYig9ovGBIOhKzod9ziwHGAgAyOkhaP3Ruf6ubhLzwPUxErX5I1 +I9GC5gPC5pUx5xstZDnOylQkkyiW7sDa63JDoYM= Date: Sat, 21 Nov 2020 11:32:51 -0500 From: Bruce Fields To: Chuck Lever Cc: Linux NFS Mailing List Subject: Re: [PATCH v2 001/118] NFSD: Fix returned READDIR offset cookie Message-ID: <20201121163251.GB3476@fieldses.org> References: <160590425404.1340.8850646771948736468.stgit@klimt.1015granger.net> <160590443133.1340.6772360578279663543.stgit@klimt.1015granger.net> <20201121005932.GD7705@fieldses.org> <771378A0-2051-4F9A-846E-91B132D698F2@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <771378A0-2051-4F9A-846E-91B132D698F2@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, Nov 21, 2020 at 11:15:54AM -0500, Chuck Lever wrote: > > > > On Nov 20, 2020, at 7:59 PM, bfields@fieldses.org wrote: > > > > On Fri, Nov 20, 2020 at 03:33:51PM -0500, Chuck Lever wrote: > >> Code inspection shows that the server's NFSv3 READDIR implementation > >> returns the same offset cookie as the client sent, instead of the > >> last cookie it returns in the reply's dirlist. This is unlike the > >> NFSv2 READDIR, NFSv3 READDIRPLUS, and NFSv4 READDIR implementations, > >> and it's been like this since the beginning of kernel git history. > > > > Surely this should have caused actual failures in practice. > > > >> I copied the logic from nfsd3_proc_readdirplus(). > >> > >> Signed-off-by: Chuck Lever > >> --- > >> fs/nfsd/nfs3proc.c | 7 ++++--- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c > >> index d9be589fed15..e0ad18d6b5a8 100644 > >> --- a/fs/nfsd/nfs3proc.c > >> +++ b/fs/nfsd/nfs3proc.c > >> @@ -430,6 +430,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) > >> struct nfsd3_readdirargs *argp = rqstp->rq_argp; > >> struct nfsd3_readdirres *resp = rqstp->rq_resp; > >> int count = 0; > >> + loff_t offset; > >> struct page **p; > >> caddr_t page_addr = NULL; > >> > >> @@ -448,7 +449,9 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) > >> resp->common.err = nfs_ok; > >> resp->buffer = argp->buffer; > >> resp->rqstp = rqstp; > >> - resp->status = nfsd_readdir(rqstp, &resp->fh, (loff_t *)&argp->cookie, > > > > Doesn't nfsd_readdir() update argp->cookie to point to the last offset? > > > >> + offset = argp->cookie; > >> + > >> + resp->status = nfsd_readdir(rqstp, &resp->fh, &offset, > >> &resp->common, nfs3svc_encode_entry); > >> memcpy(resp->verf, argp->verf, 8); > >> count = 0; > >> @@ -464,8 +467,6 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) > >> } > >> resp->count = count >> 2; > >> if (resp->offset) { > >> - loff_t offset = argp->cookie; > > > > So, this shouldn't be equal to the initial cookie any more. > > > > Am I missing something? > > No, my mistake. This works as we expect. Thanks for the review! > > However, I find it confusing that nfsd3_proc_readdir() is structured > differently than the other three readdir proc methods, and for no > documented reason. > > Would you still be willing to consider this patch relabeled as a clean-up ? Sure, seems fine, and if it confused you then it'd probably confuse someone else. --b.