[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZKfr5ZIvNBmKDQI@infradead.org>
Date: Mon, 15 Nov 2021 09:58:07 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Jubin Zhong <zhongjubin@...wei.com>
Cc: viro@...iv.linux.org.uk, wangfangpeng1@...wei.com,
kechengsong@...wei.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: Fix truncate never updates m/ctime
On Mon, Nov 15, 2021 at 07:00:18PM +0800, Jubin Zhong wrote:
> From: zhongjubin <zhongjubin@...wei.com>
>
> Syscall truncate() never updates m/ctime even if the file size is
> changed. However, this is incorrect according to man file:
>
> truncate (2):
> If the size changed, then the st_ctime and st_mtime fields
> (respectively, time of last status change and time of last modification;
> see stat(2)) for the file are updated, and the set-user-ID and
> set-group-ID mode bits may be cleared.
>
> Check file size before do_truncate() to fix this.
Please try to actually reproduce your alleged "bug". And maybe also
look at the actual setattr implementations. Hint: The XFS one even
has extensive comments.
Powered by blists - more mailing lists