Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp812778ybl; Wed, 11 Dec 2019 07:54:34 -0800 (PST) X-Google-Smtp-Source: APXvYqx853wbxZXNV4bW1UDIBFhMsGLhvRp9uRvE6SKskj5Zav3veV5oSKp7zPClwWLphGYgbn7u X-Received: by 2002:aca:ea43:: with SMTP id i64mr3441755oih.30.1576079674408; Wed, 11 Dec 2019 07:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576079674; cv=none; d=google.com; s=arc-20160816; b=fMW0bjEUf4JHM2mLI7vH6OBbmtGjya4geuF38vKY/i2VoeLKxc0FbKF9FI6kwZtRh+ 3YbB2oYdQWa64WrQQVebFljf8VAG3Ge9nj9pzsRHscEOOgJDftFjVDi0gaicsD49ipLb jkzpq8Sa7c4IrbWLf30Z3foZguACD92mq5TXLTgyTdLIlmYh90FgdyfU3KtpjnJxqTIR 8HLD4NHwoSV8eDUpaxBNxm4VABN2IujLgAn0xsn3MbBd3hnpGXQDDVDo3pYFbkT6k6hX q+PxpiBT3XKxqkUyBqZUjDYDIP61EbtoiEDlP6AyMfPVRU838h0/AAkFcgYVPfholqrQ 0Pmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4w9//EnjLLa4kIYy5bX4/1lInBxvAGNE7LYK90b8KEc=; b=sXGofITprDWnNsYiKofHdHv21DXLTHRlzviky+nhbCTgjEKtT6In6Yob5EvA87hINw wqLzEP+r4cGxUPWyXdWw6pFQJpquuf1gxjNhGZYFq3/D+wHU2vi63uLDLd+iVED1y7fV HYd8Le1M3IlohoJIA1IJ8xKfFP5Gr/GfssvjNGb1SKmIpbX+7gxgGn4OxgM9KVX05ipp kK+58iJcf0WC0R3y0Dt/rdj5QBiZvdE+z31NjQSCAywHDHwKDA+FQf1ZSExB62f7UMVh 6P2P+Dr9Av8ovZme0BUTda1v94XMG9jgMG+rQZzoPTi8EoDwpfAIZhamDnIQLDn4HlOo TLqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qsxbjM4b; 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 d16si1305082otc.210.2019.12.11.07.54.22; Wed, 11 Dec 2019 07:54:34 -0800 (PST) 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=qsxbjM4b; 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 S1732060AbfLKPT5 (ORCPT + 99 others); Wed, 11 Dec 2019 10:19:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:48846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732284AbfLKPTy (ORCPT ); Wed, 11 Dec 2019 10:19:54 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 498F42073D; Wed, 11 Dec 2019 15:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077593; bh=uwl3yzZIRDGIzZbhCnRwMrZw4/ssOAVybnQ82DWjROE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qsxbjM4boUB31AbILjxM6KeeNnJswSZ1i0M7C3aO9azocKCKpZtlGREo+eh/1tRvU X1mrczO41o6rvuDTRInXorIz5J4vNhIrIxbktVeLjs3px7/B/iQhXeQgPNwYaE2iWR X28GKcsm2UkrIG+oMbXSVfUCQW6octTjdGnOqgek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , Christoph Hellwig , "Darrick J. Wong" , Sasha Levin Subject: [PATCH 4.19 070/243] xfs: extent shifting doesnt fully invalidate page cache Date: Wed, 11 Dec 2019 16:03:52 +0100 Message-Id: <20191211150343.827226097@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Chinner [ Upstream commit 7f9f71be84bcab368e58020a42f6d0dd97adf0ce ] The extent shifting code uses a flush and invalidate mechainsm prior to shifting extents around. This is similar to what xfs_free_file_space() does, but it doesn't take into account things like page cache vs block size differences, and it will fail if there is a page that it currently busy. xfs_flush_unmap_range() handles all of these cases, so just convert xfs_prepare_shift() to us that mechanism rather than having it's own special sauce. Signed-off-by: Dave Chinner Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Sasha Levin --- fs/xfs/xfs_bmap_util.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 41ad9eaab6ce9..c045723678be9 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1244,13 +1244,7 @@ xfs_prepare_shift( * Writeback and invalidate cache for the remainder of the file as we're * about to shift down every extent from offset to EOF. */ - error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, offset, -1); - if (error) - return error; - error = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping, - offset >> PAGE_SHIFT, -1); - if (error) - return error; + error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip)); /* * Clean out anything hanging around in the cow fork now that -- 2.20.1