VFS: reimplement truncate mtime/ctime fix
POSIX mandates that a file's modification and change time be left untouched upon truncate/ftruncate iff the file size does not change. However, an open(O_TRUNC) call must always update the modification and change time of the file, even if it was already zero-sized. VFS uses the file systems' truncate call to implement O_TRUNC. This patch replaces git-255ae85, which did not take into account the open case. The size check is now moved into VFS, so that individual file systems need not check for this case anymore.
This commit is contained in:
@@ -563,8 +563,6 @@ off_t newsize; /* inode must become this size */
|
||||
return(EINVAL);
|
||||
if (newsize > rip->i_sp->s_max_size) /* don't let inode grow too big */
|
||||
return(EFBIG);
|
||||
if (rip->i_size == newsize)
|
||||
return(OK);
|
||||
|
||||
/* Free the actual space if truncating. */
|
||||
if (newsize < rip->i_size) {
|
||||
|
||||
Reference in New Issue
Block a user