btrfs: increase ctx->pos for delayed dir index
authorJosef Bacik <jbacik@fb.com>
Mon, 24 Jul 2017 19:14:26 +0000 (15:14 -0400)
committerDavid Sterba <dsterba@suse.com>
Fri, 18 Aug 2017 14:36:20 +0000 (16:36 +0200)
Our dir_context->pos is supposed to hold the next position we're
supposed to look.  If we successfully insert a delayed dir index we
could end up with a duplicate entry because we don't increase ctx->pos
after doing the dir_emit.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-inode.c

index 8ae409b5a61d7186f050780beced1bf72cd572ca..19e4ad2f3f2e4a32050024f34b4e0ebc3c6511b9 100644 (file)
@@ -1727,6 +1727,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
 
                if (over)
                        return 1;
+               ctx->pos++;
        }
        return 0;
 }