diff options
author | Filipe Manana <fdmanana@suse.com> | 2014-10-02 14:17:32 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-10-03 19:14:59 -0400 |
commit | bf8e8ca6fd4ac6e8edc58b92cffb2ffd51933138 (patch) | |
tree | 05d2dc341e23e280fd782b55d601c35bbcca2579 /fs/btrfs | |
parent | c926093ec516f5d316ecdf8c1be11f577ac71b85 (diff) |
Btrfs: send, don't delay dir move if there's a new parent inode
If between two snapshots we rename an existing directory named X to Y and
make it a child (direct or not) of a new inode named X, we were delaying
the move/rename of the former directory unnecessarily, which would result
in attempting to rename the new directory from its orphan name to name X
prematurely.
Minimal reproducer:
$ mkfs.btrfs -f /dev/vdd
$ mount /dev/vdd /mnt
$ mkdir -p /mnt/merlin/RC/OSD/Source
$ btrfs subvolume snapshot -r /mnt /mnt/mysnap1
$ mkdir /mnt/OSD
$ mv /mnt/merlin/RC/OSD /mnt/OSD/OSD-Plane_788
$ mv /mnt/OSD /mnt/merlin/RC
$ btrfs subvolume snapshot -r /mnt /mnt/mysnap2
$ btrfs send /mnt/mysnap1 -f /tmp/1.snap
$ btrfs send -p /mnt/mysnap1 /mnt/mysnap2 -f /tmp/2.snap
$ mkfs.btrfs -f /dev/vdc
$ mount /dev/vdc /mnt2
$ btrfs receive /mnt2 -f /tmp/1.snap
$ btrfs receive /mnt2 -f /tmp/2.snap
The second receive (from an incremental send) failed with the following
error message: "rename o261-7-0 -> merlin/RC/OSD failed".
This is a regression introduced in the 3.16 kernel.
A test case for xfstests follows.
Reported-by: Marc Merlin <marc@merlins.org>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/send.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 7edfc7cebda4..b9c27aa38d76 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -3327,7 +3327,7 @@ static int wait_for_parent_move(struct send_ctx *sctx, | |||
3327 | if (ret < 0 && ret != -ENOENT) { | 3327 | if (ret < 0 && ret != -ENOENT) { |
3328 | goto out; | 3328 | goto out; |
3329 | } else if (ret == -ENOENT) { | 3329 | } else if (ret == -ENOENT) { |
3330 | ret = 1; | 3330 | ret = 0; |
3331 | break; | 3331 | break; |
3332 | } | 3332 | } |
3333 | 3333 | ||