From: bfields@fieldses.org (J. Bruce Fields)
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 001/118] NFSD: Fix returned READDIR offset cookie
Date: Fri, 20 Nov 2020 19:59:32 -0500 [thread overview]
Message-ID: <20201121005932.GD7705@fieldses.org> (raw)
In-Reply-To: <160590443133.1340.6772360578279663543.stgit@klimt.1015granger.net>
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 <chuck.lever@oracle.com>
> ---
> 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?
--b.
> -
> if (unlikely(resp->offset1)) {
> /* we ended up with offset on a page boundary */
> *resp->offset = htonl(offset >> 32);
>
next prev parent reply other threads:[~2020-11-21 0:59 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 20:33 [PATCH v2 000/118] Update NFSD XDR functions Chuck Lever
2020-11-20 20:33 ` [PATCH v2 001/118] NFSD: Fix returned READDIR offset cookie Chuck Lever
2020-11-21 0:59 ` J. Bruce Fields [this message]
2020-11-21 16:15 ` Chuck Lever
2020-11-21 16:32 ` Bruce Fields
2020-11-20 20:33 ` [PATCH v2 002/118] SUNRPC: Add xdr_set_scratch_page() and xdr_reset_scratch_buffer() Chuck Lever
2020-11-20 20:34 ` [PATCH v2 003/118] SUNRPC: Prepare for xdr_stream-style decoding on the server-side Chuck Lever
2020-11-23 18:49 ` J. Bruce Fields
2020-11-23 18:52 ` Chuck Lever
2020-11-20 20:34 ` [PATCH v2 004/118] NFSD: Add common helpers to decode void args and encode void results Chuck Lever
2020-11-20 20:34 ` [PATCH v2 005/118] NFSD: Replace the internals of the READ_BUF() macro Chuck Lever
2020-11-23 19:18 ` J. Bruce Fields
2020-11-23 19:21 ` Chuck Lever
2020-11-20 20:34 ` [PATCH v2 006/118] NFSD: Replace READ* macros in nfsd4_decode_access() Chuck Lever
2020-11-20 20:34 ` [PATCH v2 007/118] NFSD: Replace READ* macros in nfsd4_decode_stateid() Chuck Lever
2020-11-20 20:34 ` [PATCH v2 008/118] NFSD: Replace READ* macros in nfsd4_decode_close() Chuck Lever
2020-11-20 20:34 ` [PATCH v2 009/118] NFSD: Replace READ* macros in nfsd4_decode_commit() Chuck Lever
2020-11-20 20:34 ` [PATCH v2 010/118] NFSD: Change the way the expected length of a fattr4 is checked Chuck Lever
2020-11-20 20:34 ` [PATCH v2 011/118] NFSD: Replace READ* macros that decode the fattr4 size attribute Chuck Lever
2020-11-20 20:34 ` [PATCH v2 012/118] NFSD: Replace READ* macros that decode the fattr4 acl attribute Chuck Lever
2020-11-20 20:34 ` [PATCH v2 013/118] NFSD: Replace READ* macros that decode the fattr4 mode attribute Chuck Lever
2020-11-20 20:35 ` [PATCH v2 014/118] NFSD: Replace READ* macros that decode the fattr4 owner attribute Chuck Lever
2020-11-20 20:35 ` [PATCH v2 015/118] NFSD: Replace READ* macros that decode the fattr4 owner_group attribute Chuck Lever
2020-11-20 20:35 ` [PATCH v2 016/118] NFSD: Replace READ* macros that decode the fattr4 time_set attributes Chuck Lever
2020-11-20 20:35 ` [PATCH v2 017/118] NFSD: Replace READ* macros that decode the fattr4 security label attribute Chuck Lever
2020-11-20 20:35 ` [PATCH v2 018/118] NFSD: Replace READ* macros that decode the fattr4 umask attribute Chuck Lever
2020-11-20 20:35 ` [PATCH v2 019/118] NFSD: Replace READ* macros in nfsd4_decode_fattr() Chuck Lever
2020-11-20 20:35 ` [PATCH v2 020/118] NFSD: Replace READ* macros in nfsd4_decode_create() Chuck Lever
2020-11-20 20:35 ` [PATCH v2 021/118] NFSD: Replace READ* macros in nfsd4_decode_getattr() Chuck Lever
2020-11-20 20:35 ` [PATCH v2 022/118] NFSD: Replace READ* macros in nfsd4_decode_link() Chuck Lever
2020-11-20 20:35 ` [PATCH v2 023/118] NFSD: Relocate nfsd4_decode_opaque() Chuck Lever
2020-11-20 20:35 ` [PATCH v2 024/118] NFSD: Add helpers to decode a clientid4 and an NFSv4 state owner Chuck Lever
2020-11-20 20:35 ` [PATCH v2 025/118] NFSD: Add helper for decoding locker4 Chuck Lever
2020-11-20 20:36 ` [PATCH v2 026/118] NFSD: Replace READ* macros in nfsd4_decode_lock() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 027/118] NFSD: Replace READ* macros in nfsd4_decode_lockt() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 028/118] NFSD: Replace READ* macros in nfsd4_decode_locku() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 029/118] NFSD: Replace READ* macros in nfsd4_decode_lookup() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 030/118] NFSD: Add helper to decode NFSv4 verifiers Chuck Lever
2020-11-20 20:36 ` [PATCH v2 031/118] NFSD: Add helper to decode OPEN's createhow4 argument Chuck Lever
2020-11-20 20:36 ` [PATCH v2 032/118] NFSD: Add helper to decode OPEN's openflag4 argument Chuck Lever
2020-11-20 20:36 ` [PATCH v2 033/118] NFSD: Replace READ* macros in nfsd4_decode_share_access() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 034/118] NFSD: Replace READ* macros in nfsd4_decode_share_deny() Chuck Lever
2020-11-20 20:36 ` [PATCH v2 035/118] NFSD: Add helper to decode OPEN's open_claim4 argument Chuck Lever
2020-11-20 20:36 ` [PATCH v2 036/118] NFSD: Replace READ* macros in nfsd4_decode_open() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 037/118] NFSD: Replace READ* macros in nfsd4_decode_open_confirm() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 038/118] NFSD: Replace READ* macros in nfsd4_decode_open_downgrade() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 039/118] NFSD: Replace READ* macros in nfsd4_decode_putfh() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 040/118] NFSD: Replace READ* macros in nfsd4_decode_read() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 041/118] NFSD: Replace READ* macros in nfsd4_decode_readdir() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 042/118] NFSD: Replace READ* macros in nfsd4_decode_remove() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 043/118] NFSD: Replace READ* macros in nfsd4_decode_rename() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 044/118] NFSD: Replace READ* macros in nfsd4_decode_renew() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 045/118] NFSD: Replace READ* macros in nfsd4_decode_secinfo() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 046/118] NFSD: Replace READ* macros in nfsd4_decode_setclientid() Chuck Lever
2020-11-20 20:37 ` [PATCH v2 047/118] NFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 048/118] NFSD: Replace READ* macros in nfsd4_decode_verify() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 049/118] NFSD: Replace READ* macros in nfsd4_decode_write() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 050/118] NFSD: Replace READ* macros in nfsd4_decode_release_lockowner() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 051/118] NFSD: Replace READ* macros in nfsd4_decode_cb_sec() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 052/118] NFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 053/118] NFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session() Chuck Lever
2020-11-20 20:38 ` [PATCH v2 054/118] NFSD: Add a separate decoder to handle state_protect_ops Chuck Lever
2020-11-20 20:38 ` [PATCH v2 055/118] NFSD: Add a separate decoder for ssv_sp_parms Chuck Lever
2020-11-20 20:38 ` [PATCH v2 056/118] NFSD: Add a helper to decode state_protect4_a Chuck Lever
2020-11-20 20:38 ` [PATCH v2 057/118] NFSD: Add a helper to decode nfs_impl_id4 Chuck Lever
2020-11-20 20:38 ` [PATCH v2 058/118] NFSD: Add a helper to decode channel_attrs4 Chuck Lever
2020-11-20 20:38 ` [PATCH v2 059/118] NFSD: Replace READ* macros in nfsd4_decode_create_session() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 060/118] NFSD: Replace READ* macros in nfsd4_decode_destroy_session() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 061/118] NFSD: Replace READ* macros in nfsd4_decode_free_stateid() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 062/118] NFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 063/118] NFSD: Replace READ* macros in nfsd4_decode_layoutcommit() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 064/118] NFSD: Replace READ* macros in nfsd4_decode_layoutget() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 065/118] NFSD: Replace READ* macros in nfsd4_decode_layoutreturn() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 066/118] NFSD: Replace READ* macros in nfsd4_decode_secinfo_no_name() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 067/118] NFSD: Replace READ* macros in nfsd4_decode_sequence() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 068/118] NFSD: Replace READ* macros in nfsd4_decode_test_stateid() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 069/118] NFSD: Replace READ* macros in nfsd4_decode_destroy_clientid() Chuck Lever
2020-11-20 20:39 ` [PATCH v2 070/118] NFSD: Replace READ* macros in nfsd4_decode_reclaim_complete() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 071/118] NFSD: Replace READ* macros in nfsd4_decode_fallocate() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 072/118] NFSD: Replace READ* macros in nfsd4_decode_clone() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 073/118] NFSD: Replace READ* macros in nfsd4_decode_nl4_server() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 074/118] NFSD: Replace READ* macros in nfsd4_decode_copy() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 075/118] NFSD: Replace READ* macros in nfsd4_decode_seek() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 076/118] NFSD: Replace READ* macros in nfsd4_decode_xattr_name() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 077/118] NFSD: Replace READ* macros in nfsd4_decode_setxattr() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 078/118] NFSD: Replace READ* macros in nfsd4_decode_listxattrs() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 079/118] NFSD: Replace READ* macros in nfsd4_decode_compound() Chuck Lever
2020-11-20 20:40 ` [PATCH v2 080/118] NFSD: Remove macros that are no longer used Chuck Lever
2020-11-20 20:40 ` [PATCH v2 081/118] NFSD: Update GETATTR3args decoder to use struct xdr_stream Chuck Lever
2020-11-20 20:41 ` [PATCH v2 082/118] NFSD: Update ACCESS3arg " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 083/118] NFSD: Update READ3arg " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 084/118] NFSD: Update WRITE3arg " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 085/118] NFSD: Update READLINK3arg " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 086/118] NFSD: Add helper to set up the pages where the dirlist is encoded Chuck Lever
2020-11-20 20:41 ` [PATCH v2 087/118] NFSD: Update READDIR3args decoders to use struct xdr_stream Chuck Lever
2020-11-23 20:55 ` J. Bruce Fields
2020-11-20 20:41 ` [PATCH v2 088/118] NFSD: Update COMMIT3arg decoder " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 089/118] NFSD: Update the NFSv3 DIROPargs " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 090/118] NFSD: Update the RENAME3args " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 091/118] NFSD: Update the LINK3args " Chuck Lever
2020-11-20 20:41 ` [PATCH v2 092/118] NFSD: Update the SETATTR3args " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 093/118] NFSD: Update the CREATE3args " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 094/118] NFSD: Update the MKDIR3args " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 095/118] NFSD: Update the SYMLINK3args " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 096/118] NFSD: Update the MKNOD3args " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 097/118] NFSD: Update the NFSv2 GETATTR argument " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 098/118] NFSD: Update the NFSv2 READ " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 099/118] NFSD: Update the NFSv2 WRITE " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 100/118] NFSD: Update the NFSv2 READLINK " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 101/118] NFSD: Add helper to set up the pages where the dirlist is encoded Chuck Lever
2020-11-20 20:42 ` [PATCH v2 102/118] NFSD: Update the NFSv2 READDIR argument decoder to use struct xdr_stream Chuck Lever
2020-11-20 20:42 ` [PATCH v2 103/118] NFSD: Update NFSv2 diropargs decoding " Chuck Lever
2020-11-20 20:42 ` [PATCH v2 104/118] NFSD: Update the NFSv2 RENAME argument decoder " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 105/118] NFSD: Update the NFSv2 LINK " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 106/118] NFSD: Update the NFSv2 SETATTR " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 107/118] NFSD: Update the NFSv2 CREATE " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 108/118] NFSD: Update the NFSv2 SYMLINK " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 109/118] NFSD: Remove argument length checking in nfsd_dispatch() Chuck Lever
2020-11-20 20:43 ` [PATCH v2 110/118] NFSD: Update the NFSv2 GETACL argument decoder to use struct xdr_stream Chuck Lever
2020-11-20 20:43 ` [PATCH v2 111/118] NFSD: Add an xdr_stream-based decoder for NFSv2/3 ACLs Chuck Lever
2020-11-20 20:43 ` [PATCH v2 112/118] NFSD: Update the NFSv2 SETACL argument decoder to use struct xdr_stream Chuck Lever
2020-11-20 20:43 ` [PATCH v2 113/118] NFSD: Update the NFSv2 ACL GETATTR " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 114/118] NFSD: Update the NFSv2 ACL ACCESS " Chuck Lever
2020-11-20 20:43 ` [PATCH v2 115/118] NFSD: Clean up after updating NFSv2 ACL decoders Chuck Lever
2020-11-20 20:44 ` [PATCH v2 116/118] NFSD: Update the NFSv3 GETACL argument decoder to use struct xdr_stream Chuck Lever
2020-11-20 20:44 ` [PATCH v2 117/118] NFSD: Update the NFSv2 SETACL " Chuck Lever
2020-11-20 20:44 ` [PATCH v2 118/118] NFSD: Clean up after updating NFSv3 ACL decoders Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201121005932.GD7705@fieldses.org \
--to=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).