diff options
author | Christoph Hellwig <hch@infradead.org> | 2009-12-23 11:09:13 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-01-10 13:21:58 -0500 |
commit | d6d59bada372bcf8bd36c3bbc71c485c29dd2a4b (patch) | |
tree | 140a4625597ffac953ce1d0dbbfed7caa436e053 /fs/xfs/linux-2.6/xfs_acl.c | |
parent | ea9a48881e093a41a79305fb1545ca0794b203dc (diff) |
xfs: fix timestamp handling in xfs_setattr
We currently have some rather odd code in xfs_setattr for
updating the a/c/mtime timestamps:
- first we do a non-transaction update if all three are updated
together
- second we implicitly update the ctime for various changes
instead of relying on the ATTR_CTIME flag
- third we set the timestamps to the current time instead of the
arguments in the iattr structure in many cases.
This patch makes sure we update it in a consistent way:
- always transactional
- ctime is only updated if ATTR_CTIME is set or we do a size
update, which is a special case
- always to the times passed in from the caller instead of the
current time
The only non-size caller of xfs_setattr that doesn't come from
the VFS is updated to set ATTR_CTIME and pass in a valid ctime
value.
Reported-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_acl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index 2512125dfa7c..883ca5ab8af5 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -251,8 +251,9 @@ xfs_set_mode(struct inode *inode, mode_t mode) | |||
251 | if (mode != inode->i_mode) { | 251 | if (mode != inode->i_mode) { |
252 | struct iattr iattr; | 252 | struct iattr iattr; |
253 | 253 | ||
254 | iattr.ia_valid = ATTR_MODE; | 254 | iattr.ia_valid = ATTR_MODE | ATTR_CTIME; |
255 | iattr.ia_mode = mode; | 255 | iattr.ia_mode = mode; |
256 | iattr.ia_ctime = current_fs_time(inode->i_sb); | ||
256 | 257 | ||
257 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); | 258 | error = -xfs_setattr(XFS_I(inode), &iattr, XFS_ATTR_NOACL); |
258 | } | 259 | } |