Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1910818pxb; Thu, 16 Sep 2021 20:00:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKBqIauqxmprhN0SwBoeJgGImt+2TfRVuWgu6hXpbIuBG4Nt9S94PGtfOsT6jAbeOSIOZB X-Received: by 2002:a05:6e02:1c2c:: with SMTP id m12mr3084229ilh.114.1631847621832; Thu, 16 Sep 2021 20:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631847621; cv=none; d=google.com; s=arc-20160816; b=sWjqLEW0F5XcTPhDzyobaernvcV/uI2ZEbKLRgC3FSqWf6dbSFSWBC0EMk3k+FxtNZ K3aIpoWhKXHwSyk2ycwYzHAybx0aj6x1sMZjqgz1SpQDmMfbVOKrWPH2ecr3osvGvnWG HAScp869jKyZBB2n4VZ7UZG0+PteB3uXy/GS7XAqt2atfmWBO4VzdfSSK6e8yRaZEtDe ZLpGIchP+0OESr48JIqpeeiGUsULyrpRVFK4A4+8kFqcd2bVfPeV4pawoYd10UDnnejP 0RX1bCROvvmnq/l+aCMjvcNdGvMYW/tGKFbn8ToEZFlNBKrg57X9qr9sTKhuv2SSRwAF Xhcw== 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=yJQ62GIOlqdnQD9y4TnrpE+Sw8XdoEgWuYdRwphFpYM=; b=KrzzTSnbBctmKtW+KvgeZ6RaMtbhrmYzkpOQblYmDuSxAx1tn7lmCm+JEncyfSf2/c RAHFoDFspwva7zZBJwDTyhEYVeUzuxIWKCwAtTxrJob6nzaZBRH8sXCF3XdQ8AH8zVin Aka9Fj/6k5ZUK8QQClKbMQvJ680pMRrK/Lrx6D8bqTwFYxSjhl275bag4jMNh6N/+o1O 3WBZEZp3PeiGqrcIZBigUxZYDcoXwHkNtRxbJDvp9IdHVHKQzN2+w8PaRLLf2woUpfi3 HxdBmAcC5wnzbbM17GNN14gEnO8kACecHHzc8bilAO0IxOtpM6JWh5/RIOsYbqNPTdDd 8wPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ityCdwEI; 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 m8si3886826ila.156.2021.09.16.20.00.10; Thu, 16 Sep 2021 20:00:21 -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=ityCdwEI; 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 S1348543AbhIPR0b (ORCPT + 99 others); Thu, 16 Sep 2021 13:26:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:43648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346365AbhIPRSH (ORCPT ); Thu, 16 Sep 2021 13:18:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98FC461B94; Thu, 16 Sep 2021 16:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810466; bh=tBFjU4rwxlyvopeAxHdcfhn5BIs67VvAJydquwe6SRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ityCdwEIYDq+v+X3KLdvuFI6owqaTuLBZC4ElAJfsS7EoiIDuB40SSEyvloMLHWTm pVz39sBOz9txqlWjuskKm/Ku4/RBq0bOW5JoSuhmuwT66LVydQdCQujBnoyZv+av9R 7kdGFSYTQW6SqKeYEnqMplm29OPFRENSlC/W1vrM= 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.14 151/432] f2fs: fix to unmap pages from userspace process in punch_hole() Date: Thu, 16 Sep 2021 17:58:20 +0200 Message-Id: <20210916155815.864720550@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@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 97d48c5bdebc..74f934da825f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1084,7 +1084,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); @@ -1096,8 +1095,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