Fix reading of large directories

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.

This patch is a backport of commit 39e4474396cd ("apfs: fix reading of
large directories") from the development tree, so it will be dropped for
the next "release".  From now on this branch can be considered stable.

Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
This commit is contained in:
Ernesto A. Fernández
2019-10-13 12:47:06 -03:00
parent 277a34e048
commit 2a598f1433
-1
View File
@@ -169,7 +169,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--;
}