]> git.hungrycats.org Git - linux/commitdiff
btrfs: increase ctx->pos for delayed dir index
authorJosef Bacik <jbacik@fb.com>
Mon, 24 Jul 2017 19:14:26 +0000 (15:14 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Fri, 28 Jul 2017 17:45:18 +0000 (13:45 -0400)
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>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit 599add843fa68d5873a84e7425457f3aa53d3b52)

fs/btrfs/delayed-inode.c

index dd36400ef8f89a97adfe1926b1eabaa4936ecbcd..7a173237bb1f6675e55568001844e6e354a4d6b1 100644 (file)
@@ -1734,6 +1734,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
                if (over)
                        return 1;
                *emitted = true;
+               ctx->pos++;
        }
        return 0;
 }