From patchwork Thu Mar 21 14:30:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Schmidt X-Patchwork-Id: 2313821 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BCC61DF264 for ; Thu, 21 Mar 2013 14:30:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933124Ab3CUOam (ORCPT ); Thu, 21 Mar 2013 10:30:42 -0400 Received: from xp-ob.rzone.de ([81.169.146.140]:60992 "EHLO xp-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932539Ab3CUOam (ORCPT ); Thu, 21 Mar 2013 10:30:42 -0400 X-RZG-CLASS-ID: xp Received: from pizpot.store ([192.168.43.236]) by joses.store (joses xp2) (RZmta 31.22 OK) with ESMTP id g06cf8p2L9a6D5 ; Thu, 21 Mar 2013 15:30:38 +0100 (CET) From: Jan Schmidt To: linux-btrfs@vger.kernel.org Cc: ablock84@gmail.com Subject: [PATCH] Btrfs: fix EIO from btrfs send in is_extent_unchanged for punched holes Date: Thu, 21 Mar 2013 15:30:23 +0100 Message-Id: <1363876223-18410-1-git-send-email-list.btrfs@jan-o-sch.net> X-Mailer: git-send-email 1.8.2 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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 Cc: Alexander Block --- fs/btrfs/send.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 68da757..ed897dc 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -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; }