diff options
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 094cc1444a90..5be83b5a1b43 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -3340,7 +3340,8 @@ static void free_pending_move(struct send_ctx *sctx, struct pending_dir_move *m) | |||
3340 | kfree(m); | 3340 | kfree(m); |
3341 | } | 3341 | } |
3342 | 3342 | ||
3343 | static void tail_append_pending_moves(struct pending_dir_move *moves, | 3343 | static void tail_append_pending_moves(struct send_ctx *sctx, |
3344 | struct pending_dir_move *moves, | ||
3344 | struct list_head *stack) | 3345 | struct list_head *stack) |
3345 | { | 3346 | { |
3346 | if (list_empty(&moves->list)) { | 3347 | if (list_empty(&moves->list)) { |
@@ -3351,6 +3352,10 @@ static void tail_append_pending_moves(struct pending_dir_move *moves, | |||
3351 | list_add_tail(&moves->list, stack); | 3352 | list_add_tail(&moves->list, stack); |
3352 | list_splice_tail(&list, stack); | 3353 | list_splice_tail(&list, stack); |
3353 | } | 3354 | } |
3355 | if (!RB_EMPTY_NODE(&moves->node)) { | ||
3356 | rb_erase(&moves->node, &sctx->pending_dir_moves); | ||
3357 | RB_CLEAR_NODE(&moves->node); | ||
3358 | } | ||
3354 | } | 3359 | } |
3355 | 3360 | ||
3356 | static int apply_children_dir_moves(struct send_ctx *sctx) | 3361 | static int apply_children_dir_moves(struct send_ctx *sctx) |
@@ -3365,7 +3370,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx) | |||
3365 | return 0; | 3370 | return 0; |
3366 | 3371 | ||
3367 | INIT_LIST_HEAD(&stack); | 3372 | INIT_LIST_HEAD(&stack); |
3368 | tail_append_pending_moves(pm, &stack); | 3373 | tail_append_pending_moves(sctx, pm, &stack); |
3369 | 3374 | ||
3370 | while (!list_empty(&stack)) { | 3375 | while (!list_empty(&stack)) { |
3371 | pm = list_first_entry(&stack, struct pending_dir_move, list); | 3376 | pm = list_first_entry(&stack, struct pending_dir_move, list); |
@@ -3376,7 +3381,7 @@ static int apply_children_dir_moves(struct send_ctx *sctx) | |||
3376 | goto out; | 3381 | goto out; |
3377 | pm = get_pending_dir_moves(sctx, parent_ino); | 3382 | pm = get_pending_dir_moves(sctx, parent_ino); |
3378 | if (pm) | 3383 | if (pm) |
3379 | tail_append_pending_moves(pm, &stack); | 3384 | tail_append_pending_moves(sctx, pm, &stack); |
3380 | } | 3385 | } |
3381 | return 0; | 3386 | return 0; |
3382 | 3387 | ||