Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1241495pxa; Thu, 20 Aug 2020 06:32:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxixKOmNwi7999HZ1KI7UK4ZT/PP+UMTf5wLerClKd1utK4jV0CGfKTcQoIvbRDQBvJSJr6 X-Received: by 2002:aa7:dd91:: with SMTP id g17mr3025745edv.186.1597930370178; Thu, 20 Aug 2020 06:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597930370; cv=none; d=google.com; s=arc-20160816; b=rSITrUDF1eN0NKm4Mfe7NNnJLaiuDQ6cpN11yw/lX9R75M0rgr5ipMpZSOtTZ1RBqb kuNj6RzHjsAm4GwI5UBI3NvPRFiC70LkxuA1ntPWBJ0cwyNXPEYvIuRsYX43OviSq9g0 C03qdYT0nSx9B8Q1R3BSJPb2ZGQbWWhIf3EJkXTb4qSegR6lHJc2vnCj0VPc8al26yyN OMeg0Mv3iSyvbcJ+vMFcHrcPEKxzuJWnZ8gqqJDfenwIj52A7fvW3qvyr1a8Fa6WW10h iaiWpeHle7uY5n7L4VRDp8x4/gRvtAy4gtEXtcPEK+HV+7sZIk5Q0nJG57kE3UY/pxxx xHeQ== 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=ho4d8jSmzIoCvnkMgKdwSNrdFff43eDrdYwMYOc2FqI=; b=S6oyGyuVCQAjK6zef/VZCRW7/2Cn/2usAxodmX0gDjE8L7/0pomEDYFrYxMPmRtBMv nVo9prV9vcc0qf1DgLBWqewfnIf5vP+NoBuz05KSdBl6OXHEgd1RCF9TTYuXe3A9yxH+ rhxjfVFWi2RcpiqlevYTmjxAcLNanBZ/+wn6b+ZK7hjTvCf9Hq2SowFC232QP8wSkOVM HMr3fXLQ5hwfHHa6hlS7uzqFjudv8zM9e9WKLjptLLyf79aEmlIC/x0zLa6FnGv9RElu OJWCffA/qyLhUk+kXcNfzmlHoynhIWJgzonCElZcOV0fqMppI/mHahUwoP61kEOUUn7q IszA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fuFN5He1; 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=fail (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 i23si1379981eds.484.2020.08.20.06.32.25; Thu, 20 Aug 2020 06:32:50 -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=@kernel.org header.s=default header.b=fuFN5He1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729191AbgHTNbd (ORCPT + 99 others); Thu, 20 Aug 2020 09:31:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:45002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728272AbgHTJce (ORCPT ); Thu, 20 Aug 2020 05:32:34 -0400 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 06FB822BEF; Thu, 20 Aug 2020 09:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915954; bh=rOZmfox11fUmQvakmoBgObEEml7gBuYfZpBmV3cPfbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fuFN5He1zIBZY4WzSuACAmtTyZjGfLjXGK3nxX4XfH0719iQjm3KnI3Nr20Ol/5Wr xbFw2UkudGAYMiZ5ir2TJJhmv0Jkz9gPMQ3cMo8DI6JVEujHD9wCuY7ei6zHQg5PaT MStcHyHllepw4lFM4l/mv/D1B1g8NXCiRvIk0nxM= 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.8 163/232] f2fs: compress: fix to update isize when overwriting compressed file Date: Thu, 20 Aug 2020 11:20:14 +0200 Message-Id: <20200820091620.706719697@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@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: Chao Yu [ Upstream commit 944dd22ea4475bd11180fd2f431a4a547ca4d8f5 ] We missed to update isize of compressed file in write_end() with below case: cluster size is 16KB - write 14KB data from offset 0 - overwrite 16KB data from offset 0 Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/data.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 326c63879ddc8..6e9017e6a8197 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3432,6 +3432,10 @@ static int f2fs_write_end(struct file *file, if (f2fs_compressed_file(inode) && fsdata) { f2fs_compress_write_end(inode, fsdata, page->index, copied); f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); + + if (pos + copied > i_size_read(inode) && + !f2fs_verity_in_progress(inode)) + f2fs_i_size_write(inode, pos + copied); return copied; } #endif -- 2.25.1