Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2515542imm; Mon, 28 May 2018 09:32:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrub1Ke8rZKADXTyqo3FG7UhN/o+PuzJsZ9VC5estAdp2u8j8QjFc5GmUBs6OQd1usLAOxX X-Received: by 2002:a17:902:6ac6:: with SMTP id i6-v6mr14716272plt.31.1527525160897; Mon, 28 May 2018 09:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527525160; cv=none; d=google.com; s=arc-20160816; b=adYLWigkk9MaN7slgxkFsiiiVmWjFef7XRqdTJ50e2fXL5Ze9H/a5Fb5COSUf3OzQd jGnEBiBEnaq6rUMh69AjkQLo4C1zb9w6weOk3JBcSWw+AdnBCPrj+yBDvHSGK1iMzoCX c6UeN03iaugiHjyY3USmHTH08mCt4GmC0KTgAKAWeAHzCZFXOjckkGdHF8/ksXiboU65 3L472aMICIpqxiNm71flRQRGch8pWR4Z4PCYOTZ93fWSEuYs+bsFJ0tobB4X85Pb0BNG r2EtmdQdgdxawiIObNuulPy4dbVqEmvhoqpWVT3SaDEB7NhhVbebl7ZFohbeEpQfHHBB C32g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=W6gwETd3054EkbYJOf7jq1We4tbr7T9fsgr0v2Tu53E=; b=l9mTf65Nh3pPrT3AAyJ+l6A7+bczTW7+FncgsOtpC9GQwcYtIoX0zAeXhAcUiByHrx 3eQti6z9tDyfHExVhR6CyNuwBdbNpWtJskP710oEOh2qmDJd0XN8gt7hR4xgEuUNw6+n 5moTAZO5h8ujXiqPbTs38Gd7C5q4J6ZHvIC2olM82tKb8rkfng2SEVQqcYtMt7PhxzJI LYNXT0FvSofFn7gvSA0YUVvIdkZyKxmAyJUD/Vj3nXj8H4w0uCZEphixYYKC2cz+5nYd P8W+xm6S3+pbbRl+AXOem+f2QeLuJGl+EFvji1XldmtUuFEMEkGrpTM3r0DyfDQHo1sf 7yvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCbApQYe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19-v6si12032038pll.32.2018.05.28.09.32.26; Mon, 28 May 2018 09:32:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCbApQYe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754515AbeE1KJX (ORCPT + 99 others); Mon, 28 May 2018 06:09:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:57376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935270AbeE1KJQ (ORCPT ); Mon, 28 May 2018 06:09:16 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F15E208AF; Mon, 28 May 2018 10:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502155; bh=3XWFhOWXFql8t9nlNfqSfZj8u1qlrdBlQoIG5zMQqdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCbApQYeNdabp9JYW9ZPklwV0oqu63JfTt6bWL0u8iRWxdALf767Nb0b5DgKBhGJm QiR4dHmN/cUUeJ6Bxkd2oOmhUZ+gwkcJ4UXP5e6mRCYehl3TO+HR+GVrdBol+fDy3m a4YvK0nFaImFLSQy7rnYL5hXqu0NmlhtiDpy2fg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , David Sterba , Sasha Levin Subject: [PATCH 3.18 083/185] Btrfs: send, fix issuing write op when processing hole in no data mode Date: Mon, 28 May 2018 12:02:04 +0200 Message-Id: <20180528100057.695555301@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Filipe Manana [ Upstream commit d4dfc0f4d39475ccbbac947880b5464a74c30b99 ] When doing an incremental send of a filesystem with the no-holes feature enabled, we end up issuing a write operation when using the no data mode send flag, instead of issuing an update extent operation. Fix this by issuing the update extent operation instead. Trivial reproducer: $ mkfs.btrfs -f -O no-holes /dev/sdc $ mkfs.btrfs -f /dev/sdd $ mount /dev/sdc /mnt/sdc $ mount /dev/sdd /mnt/sdd $ xfs_io -f -c "pwrite -S 0xab 0 32K" /mnt/sdc/foobar $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap1 $ xfs_io -c "fpunch 8K 8K" /mnt/sdc/foobar $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap2 $ btrfs send /mnt/sdc/snap1 | btrfs receive /mnt/sdd $ btrfs send --no-data -p /mnt/sdc/snap1 /mnt/sdc/snap2 \ | btrfs receive -vv /mnt/sdd Before this change the output of the second receive command is: receiving snapshot snap2 uuid=f6922049-8c22-e544-9ff9-fc6755918447... utimes write foobar, offset 8192, len 8192 utimes foobar BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=f6922049-8c22-e544-9ff9-... After this change it is: receiving snapshot snap2 uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64... utimes update_extent foobar: offset=8192, len=8192 utimes foobar BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64... Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/send.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -4485,6 +4485,9 @@ static int send_hole(struct send_ctx *sc u64 len; int ret = 0; + if (sctx->flags & BTRFS_SEND_FLAG_NO_FILE_DATA) + return send_update_extent(sctx, offset, end - offset); + p = fs_path_alloc(); if (!p) return -ENOMEM;