• Josef Bacik's avatar
    Btrfs: fix estale with btrfs send · 139f807a
    Josef Bacik authored
    This fixes bugzilla 57491.  If we take a snapshot of a fs with a unlink ongoing
    and then try to send that root we will run into problems.  When comparing with a
    parent root we will search the parents and the send roots commit_root, which if
    we've just created the snapshot will include the file that needs to be evicted
    by the orphan cleanup.  So when we find a changed extent we will try and copy
    that info into the send stream, but when we lookup the inode we use the normal
    root, which no longer has the inode because the orphan cleanup deleted it.  The
    best solution I have for this is to check our otransid with the generation of
    the commit root and if they match just commit the transaction again, that way we
    get the changes from the orphan cleanup.  With this patch the reproducer I made
    for this bugzilla no longer returns ESTALE when trying to do the send.  Thanks,
    
    Cc: stable@vger.kernel.org
    Reported-by: default avatarChris Wilson <jakdaw@gmail.com>
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    139f807a
send.c 106 KB