From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932431AbbI1Jqp (ORCPT ); Mon, 28 Sep 2015 05:46:45 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:57886 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756888AbbI1Jqo (ORCPT ); Mon, 28 Sep 2015 05:46:44 -0400 X-AuditID: cbfee61b-f79d56d0000048c5-f0-56090c82837c From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: fix to update {m,c}time correctly when truncating larger Date: Mon, 28 Sep 2015 17:46:01 +0800 Message-id: <006f01d0f9d2$94c9dcd0$be5d9670$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdD50m7vReopujRlRoSYoYa9/Xu4ug== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsVy+t9jQd1mHs4wgxsPmC2erJ/FbHFpkbvF 5V1z2ByYPTat6mTz2L3gM5PH501yAcxRXDYpqTmZZalF+nYJXBmzz71iL5jMWbFoZTdjA+M0 9i5GDg4JAROJU4/ruhg5gUwxiQv31rN1MXJxCAnMYpQ4urUBynnFKDH93Fs2kCo2ARWJ5R3/ mUBsESD70KLL7CA2s4CHRGPHd1YQW1jAX2Lm0VNgNouAqkT3+zMsIDavgKXExlPrGSFsQYkf k++xQPRqSazfeZwJwpaX2LzmLTPERQoSO86+ZoTYpSdxon8vVI24xMYjt1gmMAKdiTBqFpJR s5CMmoWkZQEjyypGidSC5ILipPRco7zUcr3ixNzi0rx0veT83E2M4CB+Jr2D8fAu90OMAhyM Sjy8HzQ5woRYE8uKK3MPMUpwMCuJ8Cqxc4YJ8aYkVlalFuXHF5XmpBYfYpTmYFES571xiCFM SCA9sSQ1OzW1ILUIJsvEwSnVwKh6Nm2aDvOZw/LKv2fmLOvhWBRyYzqrSKa7yn3Rr1zuc2/9 2bmm/CXf31A259zHb26s/R8RJ6964uIhC5bk82v++uitrLPzm/pz04NT8cz/PbL+Zx+4xrir VziiIyHlcMbVi1WyYTwuSy1PpKi8X2XxYXHIq5kP/2/T3Vg++fm2pVMDLgSt4tyjxFKckWio xVxUnAgAFDTx9V4CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes to update ctime and atime correctly when truncating larger in ->setattr. The bug is reported by xfstest generic/313 as below: generic/313 2s ... - output mismatch (see ./results/generic/313.out.bad) --- tests/generic/313.out 2015-08-04 15:28:53.430798882 +0800 +++ results/generic/313.out.bad 2015-09-28 17:04:27.294278016 +0800 @@ -1,2 +1,4 @@ QA output created by 313 Silence is golden +ctime not updated after truncate up +mtime not updated after truncate up ... (Run 'diff -u tests/generic/313.out tests/generic/313.out.bad' to see the entire diff) Ran: generic/313 Failures: generic/313 Failed 1 of 1 tests Signed-off-by: Chao Yu --- fs/f2fs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c365f66..06898f1 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -681,6 +681,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr) * larger than i_size. */ truncate_setsize(inode, attr->ia_size); + inode->i_mtime = inode->i_ctime = CURRENT_TIME; } } -- 2.5.2