Re: [PATCH v6 3/4] vfs: Add timestamp_truncate() api

From: Deepa Dinamani
Date: Tue Jan 23 2018 - 11:25:43 EST


On Mon, Jan 22, 2018 at 12:25 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Sun, Jan 21, 2018 at 6:04 PM, Deepa Dinamani <deepa.kernel@xxxxxxxxx> wrote:
>> + t.tv_nsec -= t.tv_nsec % gran;
>
> This doesn't actuall ywork if tv_nsec is negative.

Right.

> Which may not be an issue in most cases, but did somebody check
> utimensat() or whatever?

I checked POSIX again. There is no mention of tv_nsec being positive
always for utimes.
And, the long term plan is to replace all the callers of
timespec_trunc() to use this new api instead for filesystems.
So this will need to be fixed. I will fix this and post an update.

>> + WARN(1, "illegal file time granularity: %u", gran);
>
> .. small nit: we generally should use 'invalid' rather than 'illegal'.

Will update this as well.

Thanks,
Deepa