From 39e4474396cd50110ae8734eb99facf0dc5ce67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20A=2E=20Fern=C3=A1ndez?= Date: Sun, 13 Oct 2019 12:47:06 -0300 Subject: [PATCH] apfs: fix reading of large directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A single call to apfs_readdir() is not necessarily enough to list a whole directory; ctx->pos tries to keep track of the last dentry found, so that the next call can continue from the same spot. Now that the module can create large numbers of files, it has become obvious that this doesn't work: many files are missing from the ls output for big directories. The bug is very simple: ctx->pos is being incremented twice for each new record. Remove one of the increments. Signed-off-by: Ernesto A. Fernández --- fs/apfs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/apfs/dir.c b/fs/apfs/dir.c index 392dab52edf9..0cd1cdd12581 100644 --- a/fs/apfs/dir.c +++ b/fs/apfs/dir.c @@ -218,7 +218,6 @@ static int apfs_readdir(struct file *file, struct dir_context *ctx) if (!dir_emit(ctx, drec.name, drec.name_len, drec.ino, drec.type)) break; - ctx->pos++; } pos--; }