Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332516
b: refs/heads/master
c: 6d85ed0
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Block authored and Chris Mason committed Oct 1, 2012
1 parent f694d13 commit b294b96
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2981e225f7048b36470383bf5622c42139bd96f7
refs/heads/master: 6d85ed05e16e7ff747025c8374f23d7d81c98540
21 changes: 20 additions & 1 deletion trunk/fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -2627,6 +2627,12 @@ static int can_rmdir(struct send_ctx *sctx, u64 dir, u64 send_progress)
struct btrfs_key loc;
struct btrfs_dir_item *di;

/*
* Don't try to rmdir the top/root subvolume dir.
*/
if (dir == BTRFS_FIRST_FREE_OBJECTID)
return 0;

path = alloc_path_for_send();
if (!path)
return -ENOMEM;
Expand Down Expand Up @@ -2687,6 +2693,12 @@ static int process_recorded_refs(struct send_ctx *sctx)

verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino);

/*
* This should never happen as the root dir always has the same ref
* which is always '..'
*/
BUG_ON(sctx->cur_ino <= BTRFS_FIRST_FREE_OBJECTID);

valid_path = fs_path_alloc(sctx);
if (!valid_path) {
ret = -ENOMEM;
Expand Down Expand Up @@ -4094,7 +4106,14 @@ static int changed_inode(struct send_ctx *sctx,

right_gen = btrfs_inode_generation(sctx->right_path->nodes[0],
right_ii);
if (left_gen != right_gen)

/*
* The cur_ino = root dir case is special here. We can't treat
* the inode as deleted+reused because it would generate a
* stream that tries to delete/mkdir the root dir.
*/
if (left_gen != right_gen &&
sctx->cur_ino != BTRFS_FIRST_FREE_OBJECTID)
sctx->cur_inode_new_gen = 1;
}

Expand Down

0 comments on commit b294b96

Please sign in to comment.