From: Alexander Block Date: Sat, 28 Jul 2012 09:46:29 +0000 (+0200) Subject: Btrfs: add correct parent to check_dirs when dir got moved X-Git-Tag: v3.12-rc1~2047^2~128 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ccf1626b49a94d66f3bb58d634888049ac695b46;p=kernel%2Fkernel-generic.git Btrfs: add correct parent to check_dirs when dir got moved We only added the parent for the new position of a moved dir. We also need to add the old parent of the moved dir. Reported-by: Alex Lyakas Signed-off-by: Alexander Block --- diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 9e3f6d1..328654e 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -2805,6 +2805,17 @@ verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); if (ret < 0) goto out; } + } else if (S_ISDIR(sctx->cur_inode_mode) && + !list_empty(&sctx->deleted_refs)) { + /* + * We have a moved dir. Add the old parent to check_dirs + */ + cur = list_entry(sctx->deleted_refs.next, struct recorded_ref, + list); + ret = ulist_add(check_dirs, cur->dir, cur->dir_gen, + GFP_NOFS); + if (ret < 0) + goto out; } else if (!S_ISDIR(sctx->cur_inode_mode)) { /* * We have a non dir inode. Go through all deleted refs and