cifs: fix skipping to incorrect offset in emit_cached_dirents
authorRonnie Sahlberg <lsahlber@redhat.com>
Tue, 11 Oct 2022 22:07:29 +0000 (08:07 +1000)
committerSteve French <stfrench@microsoft.com>
Tue, 11 Oct 2022 22:23:00 +0000 (17:23 -0500)
commit780614ce1988f9d8ab05a58b49d5506bca60b935
treee9f56ca634449722fd53b1119f8fd2f3a63127f0
parentac1e8c6c95bf805c699656046aef0a05205edfbd
cifs: fix skipping to incorrect offset in emit_cached_dirents

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.

We need to also make sure that when we are starting to emit directory
entries from the cache, the ->pos sequence might have holes and skip
some indices.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Tom Talpey <tom@talpey.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/readdir.c