Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1280574imw; Tue, 5 Jul 2022 06:56:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1OA6lxUoCLK2ASAd5UKusfI3dTG1lGB/ZlBcEuzdArYPInEa4RXxCby8gH6arE6WOrrpz X-Received: by 2002:a17:906:77cd:b0:722:e1ba:9655 with SMTP id m13-20020a17090677cd00b00722e1ba9655mr33626105ejn.445.1657029377416; Tue, 05 Jul 2022 06:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657029377; cv=none; d=google.com; s=arc-20160816; b=BZizPLyM3liw7wcAQOI4EG3ceHeF/mv2yEi0Fgyf8MbeQdBDTib0PmtEsLqQ3J3ZlR aWFRehOxT91QvKl8z445iLN7vj/Vi2QGCBTJRMAVXc4vsUdf9PgWPToi9dIXV1YbPPXV 7OWRFshrg+2QuHdA7TcGS22X95s8G7+SjVP1sw8ittq3j87QaVMOEEx6743dliuRQAMY Dh27ru1srWnIiLg3D8JxCvqHEZ1eWUfo2WrQom14qumdBo/HF99qYY9l10avI98rfN93 nZmVwcfaSXwAk6Vux7rHQDJI0xUZumBAqGhvlKsjUSkADDljJ2a3rNLGjBHBQ9jIVrPZ xlGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=negPdIy3TpEaITncm8Yf1vnR5jb2kB2vKff3bf7vKmU=; b=jES4gRearIViUod/YjmwYRKrRggOweTrtmH6HLFCMBaNEYbcvHyj5xQ1LcRxv4OrAZ tdQ/88ZCLQQiwQKuw8yIalwHFP3YmGwq/6T5aMLbBJilJylGjmgZ49+3kcactOPfVsMV OaT034KDA1NLoullr4qLu9ju/TjWCX6KxEBzGnjVC17apOH/CAX68uX6X6D0LzvoW84k iiiXiGPRqdfG5BkBaAbHwLadIQJrzC9UrKbxQreNw/Or8yPlsIcY7HeZRP5tjr+8CDM+ +mWGGKOQB5T3cOF/d5NKg1f1pFVyTFVcRkaz/3w8o3rhiku7/69SfQauCPngo6X0Q876 b9jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EO3WomPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4-20020a170906794400b006fe95bb93b3si9636240ejo.861.2022.07.05.06.55.51; Tue, 05 Jul 2022 06:56:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EO3WomPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235974AbiGEMPn (ORCPT + 99 others); Tue, 5 Jul 2022 08:15:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235207AbiGEMIm (ORCPT ); Tue, 5 Jul 2022 08:08:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFD118345; Tue, 5 Jul 2022 05:08:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B1994CE1B87; Tue, 5 Jul 2022 12:08:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A16D5C341CB; Tue, 5 Jul 2022 12:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022888; bh=hoLSOmY0encCMcz8kriaTtmJ2l5lUCnPyPwV9DNXjwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EO3WomPOx4r2bh3AqJRzJWADdoZMQfntWhEfoM6owW3/2cNRoEzy4E3dSGb4zNpr2 p8azuwiLB4t3qHyqyOdrJLFQY3PtyasnuiaW3U2jk64m80gKXrY+drGBsS4ykAqiPb /bmE1xqNz/v0nGDVjfpNx4ftL63fhlyqPiHE0Dy0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Chandan Babu R , Brian Foster , Amir Goldstein Subject: [PATCH 5.10 47/84] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Date: Tue, 5 Jul 2022 13:58:10 +0200 Message-Id: <20220705115616.699746148@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115615.323395630@linuxfoundation.org> References: <20220705115615.323395630@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Darrick J. Wong" commit d4f74e162d238ce00a640af5f0611c3f51dad70e upstream. The final parameter of filemap_write_and_wait_range is the end of the range to flush, not the length of the range to flush. Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare") Signed-off-by: Darrick J. Wong Reviewed-by: Chandan Babu R Reviewed-by: Brian Foster Signed-off-by: Amir Goldstein Acked-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_reflink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1503,7 +1503,8 @@ xfs_reflink_unshare( if (error) goto out; - error = filemap_write_and_wait_range(inode->i_mapping, offset, len); + error = filemap_write_and_wait_range(inode->i_mapping, offset, + offset + len - 1); if (error) goto out;