Add FSAL_ATTR_ATIME_SERVER and FSAL_ATTR_MTIME_SERVER

These new FSAL attribute flags will allow passing of
SET_TO_SERVER_TIME into FSAL.

Later patches will implement this functionality.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Add cache_inode_check_setattr_perms and need_wr_lock to cache_inode_lock_trust_attrs

Add a new permission checking routine in cache inode to validate permissions for
setattr.

New setattr will require getting attr lock for write and we need to check trust
of attrs, so add ability in cache_inode_lock_trust_attrs to request write lock.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Add is_open_write parm to cache_inode_setattr

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Make cache_inode_setattr call FSAL_truncate the same as cache_inode_truncate

There were some differences in how FSAL_truncate was called, make them go away.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Don't call cache_inode_truncate

cache_inode_setattr already handles truncate.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove cache_inode_truncate

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Check permissions in cache_inode_setattr

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Strip permission checking from FSAL_setattrs (LUSTRE, POSIX, VFS, XFS, GPFS)

Permission checking will be done up in cache_inode_setattr

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Merge FSAL_truncate into FSAL_setattrs (LUSTRE, POSIX, VFS, XFS, GPFS)

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Enable FSAL_PROXY to pass SET_TO_SERVER_TIME4 along in FSAL_setattrs

Since FSAL_PROXY just builds a v4 SETATTRS call from the FSAL attributes,
enabling FSAL_PROXY to pass SET_TO_SERVER_TIME4 to the proxied server is
no more that enhancing conversion of FSAL attrs to NFS4 attrs.

FSAL_PROXY appears to already be able to handle size change (truncate)
within FSAL_setattrs.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Allow passing SET_TO_SERVER_TIME to file system (LUSTRE, POSIX, VFS, XFS, GPFS)

VFS and XFS have a file descriptor, so are able to use utimesn which
provides nanosecond granularity and allows setting one or both of
atime and mtime to either a specified value or to current time. This
allows a "perfect" match with the SETATTR requests.

For LUSTRE and POSIX, we must use utimes which provides only microsecond
granularity and must set both times (though it can set both times to
current time). If only one time is set to server time, then we use
gettimeofday to set it. If one of the times is not set, then it
is "re-set" using the recently fetched attributes. This clearly is
not ideal, but is the best we can do.

GPFS OPENHANDLE_SET_XSTAT is able to handle all the intricacies of
SETATTR. Minor bug fix though, we were not originally setting
nseconds for atime and mtime...

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
One more fix for PROXY for SET_TO_SERVER_TIME

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Don't make local copy of passed attr in GPFSFSAL_setattrs

A local copy was made so umask could be applied. This can be
applied as the mode is copied into the gpfsfsal_xstat_t
that is passed to fsal_set_xstat_by_handle.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Only get current attr in GPFSFSAL_setattrs when FSAL is at NIV_DEBUG

Also, if we fail to get the attributes, don't return the error, just
zero out the attributes (but log a message).

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Simplify test of needing to call fsal_set_xstat_by_handle for GPFS

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Remove setfsuid/setfsgid from GPFS setattrs path

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Make use of FSAL_ATTR_MTIME_SERVER and FSAL_ATTR_ATIME_SERVER

Now that FSALs are prepared to take "set to server time", we
will use the new attribute flags for that to let the FSAL
handle setting to server time.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>
Stop calling FSAL_truncate from cache_inode_setattr

Now that FSALs are capable of handling truncate as part of
FSAL_setattrs, stop calling FSAL_truncate.

Signed-off-by: Frank Filz <ffilz@us.ibm.com>