linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents
Date: Thu, 6 Oct 2022 00:21:23 -0500	[thread overview]
Message-ID: <CAH2r5mthpPrijJkHCPssCbXy76V=b-FWnsBP1GZkyD_frztkaQ@mail.gmail.com> (raw)
In-Reply-To: <20221006043609.1193398-2-lsahlber@redhat.com>

tentatively added to cifs-2.6.git for-next pending testing

On Wed, Oct 5, 2022 at 11:36 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> When application has done lseek() to a different offset on a directory fd
> we skipped one entry too many before we start emitting directory entries
> from the cache.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/readdir.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
> index 8e060c00c969..da0d1e188432 100644
> --- a/fs/cifs/readdir.c
> +++ b/fs/cifs/readdir.c
> @@ -847,9 +847,13 @@ static bool emit_cached_dirents(struct cached_dirents *cde,
>         int rc;
>
>         list_for_each_entry(dirent, &cde->entries, entry) {
> -               if (ctx->pos >= dirent->pos)
> +               /*
> +                * Skip ahead until we get to the current position of the
> +                * directory.
> +                */
> +               if (ctx->pos > dirent->pos)
>                         continue;
> -               ctx->pos = dirent->pos;
> +
>                 rc = dir_emit(ctx, dirent->name, dirent->namelen,
>                               dirent->fattr.cf_uniqueid,
>                               dirent->fattr.cf_dtype);
> --
> 2.35.3
>


-- 
Thanks,

Steve

  parent reply	other threads:[~2022-10-06  5:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06  4:36 cifs: fix failure for generic/257 Ronnie Sahlberg
2022-10-06  4:36 ` [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents Ronnie Sahlberg
2022-10-06  5:18   ` Steve French
2022-10-06  5:21   ` Steve French [this message]
2022-10-08 15:21   ` Steve French
2022-10-09 17:54   ` Aurélien Aptel
2022-10-10  5:12     ` ronnie sahlberg
2022-10-10 20:42 cifs: fix bug when skipping one entry too many after lseek() Ronnie Sahlberg
2022-10-10 20:42 ` [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents Ronnie Sahlberg
2022-10-11  6:46 cifs: fix skipping to incorrect offset in emit_cached_diretns Ronnie Sahlberg
2022-10-11  6:46 ` [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents Ronnie Sahlberg
2022-10-11 16:38   ` Tom Talpey
2022-10-11 21:38     ` Steve French
2022-10-11 21:54     ` ronnie sahlberg
2022-10-11 22:07 cifs: fix emitting cached direntries Ronnie Sahlberg
2022-10-11 22:07 ` [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents Ronnie Sahlberg
2022-10-12  0:49   ` Tom Talpey
2022-10-12  1:04     ` Leif Sahlberg

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='CAH2r5mthpPrijJkHCPssCbXy76V=b-FWnsBP1GZkyD_frztkaQ@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    /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).