Btrfs: fix EIO from btrfs send in is_extent_unchanged for punched holes
authorJan Schmidt <list.btrfs@jan-o-sch.net>
Thu, 21 Mar 2013 14:30:23 +0000 (14:30 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Thu, 28 Mar 2013 13:51:26 +0000 (09:51 -0400)
When you take a snapshot, punch a hole where there has been data, then take
another snapshot and try to send an incremental stream, btrfs send would
give you EIO. That is because is_extent_unchanged had no support for holes
being punched. With this patch, instead of returning EIO we just return
0 (== the extent is not unchanged) and we're good.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Cc: Alexander Block <ablock84@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/send.c

index 68da757615ae55b8b9eaec3a68d6ec346e856761..ed897dc113568b3e49c1a16db4a37ea21714b99d 100644 (file)
@@ -3945,12 +3945,10 @@ static int is_extent_unchanged(struct send_ctx *sctx,
                    found_key.type != key.type) {
                        key.offset += right_len;
                        break;
-               } else {
-                       if (found_key.offset != key.offset + right_len) {
-                               /* Should really not happen */
-                               ret = -EIO;
-                               goto out;
-                       }
+               }
+               if (found_key.offset != key.offset + right_len) {
+                       ret = 0;
+                       goto out;
                }
                key = found_key;
        }