aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2016-06-17 12:13:36 -0400
committerFilipe Manana <fdmanana@suse.com>2016-08-01 02:23:20 -0400
commit7969e77a73164b418da851cbae35cdd6c1b43fee (patch)
treed1d5180d948bf266587333c85e3581b21a7b7cbd
parent801bec365e0e19f2ba066cd3e25a67dee21b4aae (diff)
Btrfs: send, add missing error check for calls to path_loop()
The function path_loop() can return a negative integer, signaling an error, 0 if there's no path loop and 1 if there's a path loop. We were treating any non zero values as meaning that a path loop exists. Fix this by explicitly checking for errors and gracefully return them to user space. Signed-off-by: Filipe Manana <fdmanana@suse.com>
-rw-r--r--fs/btrfs/send.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 993e1bab0a6b..0dc05bb856ff 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3200,6 +3200,8 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm)
3200 3200
3201 sctx->send_progress = sctx->cur_ino + 1; 3201 sctx->send_progress = sctx->cur_ino + 1;
3202 ret = path_loop(sctx, name, pm->ino, pm->gen, &ancestor); 3202 ret = path_loop(sctx, name, pm->ino, pm->gen, &ancestor);
3203 if (ret < 0)
3204 goto out;
3203 if (ret) { 3205 if (ret) {
3204 LIST_HEAD(deleted_refs); 3206 LIST_HEAD(deleted_refs);
3205 ASSERT(ancestor > BTRFS_FIRST_FREE_OBJECTID); 3207 ASSERT(ancestor > BTRFS_FIRST_FREE_OBJECTID);