linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ronnie sahlberg <ronniesahlberg@gmail.com>
To: "Aurélien Aptel" <aurelien.aptel@gmail.com>
Cc: Ronnie Sahlberg <lsahlber@redhat.com>,
	linux-cifs <linux-cifs@vger.kernel.org>,
	Steve French <smfrench@gmail.com>
Subject: Re: [PATCH] cifs: fix skipping to incorrect offset in emit_cached_dirents
Date: Mon, 10 Oct 2022 15:12:31 +1000	[thread overview]
Message-ID: <CAN05THTyJ3+iFLs8SjKUzu71G2PyJRfaYj9UqQ0zXXmMPH67Cg@mail.gmail.com> (raw)
In-Reply-To: <CA+5B0FM0t5vF8oHCbhc8Cj3vQ6eUas3WPFH7d0RmqC2c+TRAbQ@mail.gmail.com>

On Mon, 10 Oct 2022 at 04:04, Aurélien Aptel <aurelien.aptel@gmail.com> wrote:
>
> Hi,
>
> Make sure you're not re-introducing the bug where the first few files
> are missing when mounting the root of a Windows drive.
>
> See fix https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/cifs/smb2ops.c?id=0595751f267994c3c7027377058e4185b3a28e75
>
> And bug https://bugzilla.samba.org/show_bug.cgi?id=13107

Yeah.
What confuses things is that we do not create a contignous sequence of
index positions when we emit a directory.
For the dir_context, ctx->pos starts at 0 for the first entry and then
increments by one for each other entry.
We do not currently create a contignous space but one with one or two
holes in it.
We start by explicitely emitting '.' and '..' and these are at
position 0 and 2 respectively.
But then, for a server that for example DOES return entries for '.'
and '..' we skip emitting these entries but still increment pos,
thus we end up with a sequence for index positions of the entries of
0,1,4,5,6,7,...
I.e. there is a hole in the sequence where 2 and 3 are missing becasue
these were the dot directories that the server responded
and that we did not emit, but we incremented pos.

This should ideally be fixed because otherwise, what would lseek(3), mean ?
>
> Cheers,

  reply	other threads:[~2022-10-10  5:12 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
2022-10-08 15:21   ` Steve French
2022-10-09 17:54   ` Aurélien Aptel
2022-10-10  5:12     ` ronnie sahlberg [this message]
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=CAN05THTyJ3+iFLs8SjKUzu71G2PyJRfaYj9UqQ0zXXmMPH67Cg@mail.gmail.com \
    --to=ronniesahlberg@gmail.com \
    --cc=aurelien.aptel@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=smfrench@gmail.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).