]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: replay dir_index items before other items
authorJosef Bacik <jbacik@fusionio.com>
Wed, 11 Sep 2013 15:57:23 +0000 (11:57 -0400)
committerChris Mason <chris.mason@fusionio.com>
Sat, 21 Sep 2013 15:05:25 +0000 (11:05 -0400)
commit6f14ba5f2adc9d0302886b07e06b682974aa63b5
treecb008cbc777277de5f08b45d26141a1562b4f728
parent1bf50234e73542fcf71aea36788d65803fc015d9
Btrfs: replay dir_index items before other items

A user reported a bug where his log would not replay because he was getting
-EEXIST back.  This was because he had a file moved into a directory that was
logged.  What happens is the file had a lower inode number, and so it is
processed first when replaying the log, and so we add the inode ref in for the
directory it was moved to.  But then we process the directories DIR_INDEX item
and try to add the inode ref for that inode and it fails because we already
added it when we replayed the inode.  To solve this problem we need to just
process any DIR_INDEX items we have in the log first so this all is taken care
of, and then we can replay the rest of the items.  With this patch my reproducer
can remount the file system properly instead of erroring out.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/tree-log.c