Re: ctime set by truncate even if NOCMTIME requested

From: Miklos Szeredi
Date: Tue Sep 20 2005 - 03:50:37 EST


> See the discussion on this a couple of weeks back.
>
> It is quite correct for the kernel to request that the filesystem set
> ctime/mtime on successful calls to open(O_TRUNC).
> http://www.opengroup.org/onlinepubs/009695399/toc.htm
>
> It is _incorrect_ for it to request that ctime/mtime be set (or that the
> suid/sgid mode bit be cleared) if a truncate()/ftruncate() call results
> in no size change.
> http://www.opengroup.org/onlinepubs/009695399/toc.htm
>
> So the current do_truncate() does have to be changed. Adding a check for
> IS_NOCMTIME would be wrong, though.

These are othogonal problems.

IS_NOCMTIME is the filesystem's way of saying that it doesn't need
->setattr on truncate(), write(), etc. Why? Because it can do the
[cm]time change implicitly _within_ the operation.

If IS_NOCMTIME is set, the only place where the filesystem should get
ATTR_MTIME or ATTR_CTIME (and for that matter ATTR_MTIME_SET) is from
sys_utime[s].

Miklos
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/