Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

orangefs: clean up truncate ctime and mtime setting

The ctime and mtime are always updated on a successful ftruncate and
only updated on a successful truncate where the size changed.

We handle the ``if the size changed'' bit.

This matches FUSE's behavior.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>

authored by

Martin Brandenburg and committed by
Mike Marshall
f83140c1 2fa37fd7

+1 -15
+1 -15
fs/orangefs/inode.c
··· 204 204 if (ret != 0) 205 205 return ret; 206 206 207 - /* 208 - * Only change the c/mtime if we are changing the size or we are 209 - * explicitly asked to change it. This handles the semantic difference 210 - * between truncate() and ftruncate() as implemented in the VFS. 211 - * 212 - * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a 213 - * special case where we need to update the times despite not having 214 - * these flags set. For all other operations the VFS set these flags 215 - * explicitly if it wants a timestamp update. 216 - */ 217 - if (orig_size != i_size_read(inode) && 218 - !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { 219 - iattr->ia_ctime = iattr->ia_mtime = 220 - current_fs_time(inode->i_sb); 207 + if (orig_size != i_size_read(inode)) 221 208 iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; 222 - } 223 209 224 210 return ret; 225 211 }