The patch looks functionally correct. But there are several things I
don't really like...
How about explicitly turning UTIME_NOW/UTIME_NOW into times = NULL at
the beginning of the function? That would both simplify things and
also make it absolutely sure that the two cases are handled the same
way (which makes sense, and is also what the standard wants).
I don't like adding _more_ owner checks to this function. It would be
better if we were removing them: some weird filesystems want to do
their own permission checking and so the owner checks should really be
moved into inode_change_ok().
One way to do that could be to add a pseudo attribute flag,
e.g. ATTR_TIMES_UPDATE, that tells the permission checking code to
check the owner, even when neither ATTR_[AM]TIME_SET flag is set.
Even the check for the owner in the !times case could be removed, by
adding ATTR_TIMES_UPDATE only if we don't have write permission on the
file. That's a cleanup I'd really be happy with.
All this may also be done with the ATTR_FORCE flag, but that would
mean:
- modifying lots of call sites
- making it impossible to selectively check the permission if
multiple attributes are being modified (don't know if any callers
want that though).
Miklos
--