Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1529344pxb; Thu, 16 Sep 2021 09:18:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxizNGZvtRV3b9tosV51Jawnjz8nps5pi3HoAHblna5Hi0qBa8gX1ul+RmViyYSgsysqg4F X-Received: by 2002:a05:6402:17c8:: with SMTP id s8mr7348564edy.130.1631809102934; Thu, 16 Sep 2021 09:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631809102; cv=none; d=google.com; s=arc-20160816; b=YEhxmzzevzMhbKGYjCbWKq9aAYRBOX/pBuOCyBLcaIdA97vtJGJPKgrPohuW2aaM5b e7a0wbmHNZ2lGfcK0SqNhEyu9QVt+3rXRnf8F2yrxvzchj7BfUrzXalMfgNHG6eePfKX GTSfO+RFCkZQFK8jg4hD+NyFR7vjO4pl1RfUQuHfRjhfAtfjq7yH/QV+c/4mpbDfSxdf o4vSXoaMGhygZenWJViItaYgYe53+cGpHgiGJxrUDdJT1B03wBOGHkyYs1nrD3e8InxP M/S8Q4AjMFpZ9OEtscJFrVAcXXwZq1TVSY0Ye0kSd3dO/NMUugnqJBfh330ukx+5diKw Turg== 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=Qwc9TAaiPYVe0bpi9kV56K7qa4KBwUvxp7WcoyU/iAY=; b=jg4ZQGA+ZTBtpobK9dpNoMwtNIf1zTRj14rvwIFHuyQcsD17Op986q5oLwP12BKvDA 3ZLS8QaIN2ja2T2Ffwi++TGFghggfe6yEbB4oUA94XIg0qLKj2NGE3RM+0SCrbiRh9i/ RsbBGVSu3x5L3hiTDNPQ0TP/q6xhDNaSduxQWsfFv3s8zaKBfMioMz6Z9s33Aykt4yqF A9cpHcjzklWRRorQ2OYl8hkBIE3mxcgEtzNmA1ptVOHU4lW7YCbOuB5abAemp76Z5TMu SHehI8ADD7XIHvs5MA72BRxnk7xB1FY4KpSyIe9RPRpDR3751AXIU9epZ9qwqvU+eI5r bCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaObthDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si4093785ejo.323.2021.09.16.09.17.58; Thu, 16 Sep 2021 09:18:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaObthDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S240759AbhIPQRH (ORCPT + 99 others); Thu, 16 Sep 2021 12:17:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:49032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233599AbhIPQJm (ORCPT ); Thu, 16 Sep 2021 12:09:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D74B861361; Thu, 16 Sep 2021 16:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808493; bh=1wQoxymKe5+8ox3pj2UmRtrzTKZejCj9yDewLMQIuQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaObthDb1W7FwnD4qh1oIsemr+7PG1xxXle8Anet7wFiPWhO/fTikJw/SU9ZeCB7R 9hAogblfug3cWPWyiIUhh4sMewn7/kj9o3CKmB7bZ5QqCvhD25a6SvJySn0VcvwNXf ffujFngifxbNEZqN/OCsx3VwvnnYFDxiK3AczK00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.10 104/306] f2fs: fix to unmap pages from userspace process in punch_hole() Date: Thu, 16 Sep 2021 17:57:29 +0200 Message-Id: <20210916155757.616265230@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu [ Upstream commit c8dc3047c48540183744f959412d44b08c5435e1 ] We need to unmap pages from userspace process before removing pagecache in punch_hole() like we did in f2fs_setattr(). Similar change: commit 5e44f8c374dc ("ext4: hole-punch use truncate_pagecache_range") Fixes: fbfa2cc58d53 ("f2fs: add file operations") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 6ee8b1e0e174..1fbaab1f7aba 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1080,7 +1080,6 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) } if (pg_start < pg_end) { - struct address_space *mapping = inode->i_mapping; loff_t blk_start, blk_end; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -1092,8 +1091,7 @@ static int punch_hole(struct inode *inode, loff_t offset, loff_t len) down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); down_write(&F2FS_I(inode)->i_mmap_sem); - truncate_inode_pages_range(mapping, blk_start, - blk_end - 1); + truncate_pagecache_range(inode, blk_start, blk_end - 1); f2fs_lock_op(sbi); ret = f2fs_truncate_hole(inode, pg_start, pg_end); -- 2.30.2