diff options
author | Alexander Block <ablock84@googlemail.com> | 2012-07-28 10:09:35 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-01 15:18:53 -0400 |
commit | e479d9bb5f8366a064915b3c9ac47ed6e9fcc7d3 (patch) | |
tree | d85c43600fa34d0a863e1580de2b6d868c982ba8 /fs/btrfs/send.c | |
parent | 34d73f54e2e2227cece751f168d08d3103092992 (diff) |
Btrfs: update send_progress at correct places
Updating send_progress in process_recorded_refs was not correct.
It got updated too early in the cur_inode_new_gen case.
Reported-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
Reported-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Alexander Block <ablock84@googlemail.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 02e901adc3e8..f618224d2326 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -2886,12 +2886,6 @@ verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); | |||
2886 | } | 2886 | } |
2887 | } | 2887 | } |
2888 | 2888 | ||
2889 | /* | ||
2890 | * Current inode is now at it's new position, so we must increase | ||
2891 | * send_progress | ||
2892 | */ | ||
2893 | sctx->send_progress = sctx->cur_ino + 1; | ||
2894 | |||
2895 | ret = 0; | 2889 | ret = 0; |
2896 | 2890 | ||
2897 | out: | 2891 | out: |
@@ -3896,6 +3890,15 @@ static int process_recorded_refs_if_needed(struct send_ctx *sctx, int at_end) | |||
3896 | goto out; | 3890 | goto out; |
3897 | 3891 | ||
3898 | ret = process_recorded_refs(sctx); | 3892 | ret = process_recorded_refs(sctx); |
3893 | if (ret < 0) | ||
3894 | goto out; | ||
3895 | |||
3896 | /* | ||
3897 | * We have processed the refs and thus need to advance send_progress. | ||
3898 | * Now, calls to get_cur_xxx will take the updated refs of the current | ||
3899 | * inode into account. | ||
3900 | */ | ||
3901 | sctx->send_progress = sctx->cur_ino + 1; | ||
3899 | 3902 | ||
3900 | out: | 3903 | out: |
3901 | return ret; | 3904 | return ret; |
@@ -3993,6 +3996,12 @@ static int changed_inode(struct send_ctx *sctx, | |||
3993 | 3996 | ||
3994 | sctx->cur_ino = key->objectid; | 3997 | sctx->cur_ino = key->objectid; |
3995 | sctx->cur_inode_new_gen = 0; | 3998 | sctx->cur_inode_new_gen = 0; |
3999 | |||
4000 | /* | ||
4001 | * Set send_progress to current inode. This will tell all get_cur_xxx | ||
4002 | * functions that the current inode's refs are not updated yet. Later, | ||
4003 | * when process_recorded_refs is finished, it is set to cur_ino + 1. | ||
4004 | */ | ||
3996 | sctx->send_progress = sctx->cur_ino; | 4005 | sctx->send_progress = sctx->cur_ino; |
3997 | 4006 | ||
3998 | if (result == BTRFS_COMPARE_TREE_NEW || | 4007 | if (result == BTRFS_COMPARE_TREE_NEW || |
@@ -4066,6 +4075,11 @@ static int changed_inode(struct send_ctx *sctx, | |||
4066 | ret = process_all_refs(sctx, BTRFS_COMPARE_TREE_NEW); | 4075 | ret = process_all_refs(sctx, BTRFS_COMPARE_TREE_NEW); |
4067 | if (ret < 0) | 4076 | if (ret < 0) |
4068 | goto out; | 4077 | goto out; |
4078 | /* | ||
4079 | * Advance send_progress now as we did not get into | ||
4080 | * process_recorded_refs_if_needed in the new_gen case. | ||
4081 | */ | ||
4082 | sctx->send_progress = sctx->cur_ino + 1; | ||
4069 | ret = process_all_extents(sctx); | 4083 | ret = process_all_extents(sctx); |
4070 | if (ret < 0) | 4084 | if (ret < 0) |
4071 | goto out; | 4085 | goto out; |