Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2566246lkm; Mon, 20 Sep 2021 18:53:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUtJjjQXGkc9W+4C1gCbNzofKxQgZovadpDJ+mVArGn5o3w8eYCYV7yo7eNcTGP1Gkgr6w X-Received: by 2002:a6b:7214:: with SMTP id n20mr636668ioc.194.1632189088745; Mon, 20 Sep 2021 18:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189088; cv=none; d=google.com; s=arc-20160816; b=kLx8Va8v2BTpW42Oiy+txU0b0aw1YynvmTN8W0WYDZT7U5m7RVA6tRV8Om13rlezyr 6Z9fh1R00bC11txaCz0P7HRViwuvJa3rb0yeGBpHLo+OLtJMnm51sSQaHsNEP/OnHQ2k oIHpG7NGsyMj9L0UjkhICaI+/smqbW5GDFm53L7yIh3eeddzvHDXFmzkN05auIXlZQev 8mDjbOeodpLNYlygd6RtOs6/VWmzZtQ53WkmM/RcZ5MttFpaNz0WWfJlTb5jT79Rleoz nO17HBPVrrv4OzdBJIsS48f3PEkMojNeuJnE8XenGHiBQ0m01FZ5DjNu4aqQwAUB160N fhCQ== 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=4JJsX2kyYVFQORIVPSUSbavPkeO1rBedihuP5st825w=; b=Tb72a3ySkmn3vsbYnOg2tMTaSh0DD/G/9ggFr1WjiGDIiOoq+dGbZj6+cbaMW9Q/w4 UARwHKTtJ8j1wLTAq/7vMaV95Y29ok9/C2KvLtUgZspCAkRRlWC/EFyeTumFAIrtQJLk ofNWIdEL3ScWDmWLM8XUJo0IIzs0t+9DJSS5hsG7TT4e0Bd/Nq4yq817dzOELMbWGsUp aDIzYEj1Q2YIlbPzcPP/iEwHzNK5G7uepQ928OzrR3fkiiGlRAxN2Tg3Jh4vpjKpfX+e H5e/jEKFXmz7of9dGOAVuNdIhqpz/H0qugg7vkcl077E67RtOdwW+MS+cFJeEv+RDDzj 4QCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KneWrs6q; 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 10si14924048ilq.33.2021.09.20.18.50.50; Mon, 20 Sep 2021 18:51:28 -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=KneWrs6q; 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 S1359693AbhITSLS (ORCPT + 99 others); Mon, 20 Sep 2021 14:11:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:33268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357807AbhITSFD (ORCPT ); Mon, 20 Sep 2021 14:05:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C2AE63238; Mon, 20 Sep 2021 17:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158247; bh=g7d7CyL24N/i2Co22xmpBX7KEfYzSoGdYXQ/udx51fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KneWrs6qmVzTVbe0CfPAA0GgnWqhuZi8sRpKAOXx2DDKTfVqAVjn1ZY+9uD4iopnQ QAf/pDYWXAH6B5+Gxn8F0HLcxaphJmyd9e7BHNfvWjpAWciSioFl75Zk88QywBmLQz ZJuHIM4ZRUfyq6/qx2ZpJyB6kStYJyA/HhcuTDoY= 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.4 068/260] f2fs: fix to unmap pages from userspace process in punch_hole() Date: Mon, 20 Sep 2021 18:41:26 +0200 Message-Id: <20210920163933.437958534@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163931.123590023@linuxfoundation.org> References: <20210920163931.123590023@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 f98dce4d07b3..516007bb1ced 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -981,7 +981,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); @@ -993,8 +992,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