Start snapdir_iterate traversals to begin wtih the value of zero.

The microzap hash can sometimes be zero for single digit snapnames.
The zap cursor can then have a serialized value of two (for . and ..),
and skip the first entry in the avl tree for the .zfs/snapshot directory
listing, and therefore does not return all snapshots.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Cedric Berger <cedric@precidata.com>
Signed-off-by: Tony Perkins <tperkins@datto.com>
Closes #11039
This commit is contained in:
Tony Perkins
2020-09-27 20:46:22 -04:00
committed by Brian Behlendorf
parent 3fcd737478
commit 9bd14b8724
2 changed files with 19 additions and 1 deletions
+2 -1
View File
@@ -248,7 +248,8 @@ zpl_snapdir_iterate(struct file *filp, zpl_dir_context_t *ctx)
if (!zpl_dir_emit_dots(filp, ctx))
goto out;
pos = ctx->pos;
/* Start the position at 0 if it already emitted . and .. */
pos = (ctx->pos == 2 ? 0 : ctx->pos);
while (error == 0) {
dsl_pool_config_enter(dmu_objset_pool(zfsvfs->z_os), FTAG);
error = -dmu_snapshot_list_next(zfsvfs->z_os, MAXNAMELEN,