summaryrefslogtreecommitdiffstats
path: root/fs/inotify.c
diff options
context:
space:
mode:
authorPeter Staubach <staubach@redhat.com>2006-06-25 05:48:36 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:15 -0700
commit6e656be899993f450a765056cdc8d87e58906508 (patch)
tree708037245036b7b3cef3d87299435ea461bed9c4 /fs/inotify.c
parent838cd153a5250a79a302f6c5d68a4794b70c4ccb (diff)
downloadlinux-6e656be899993f450a765056cdc8d87e58906508.tar.gz
linux-6e656be899993f450a765056cdc8d87e58906508.tar.bz2
linux-6e656be899993f450a765056cdc8d87e58906508.zip
[PATCH] ftruncate does not always update m/ctime
In the course of trying to track down a bug where a file mtime was not being updated correctly, it was discovered that the m/ctime updates were not quite being handled correctly for ftruncate() calls. Quoth SUSv3: open(2): If O_TRUNC is set and the file did previously exist, upon successful completion, open() shall mark for update the st_ctime and st_mtime fields of the file. truncate(2): Upon successful completion, if the file size is changed, this function shall mark for update the st_ctime and st_mtime fields of the file, and the S_ISUID and S_ISGID bits of the file mode may be cleared. ftruncate(2): Upon successful completion, if fildes refers to a regular file, the ftruncate() function shall mark for update the st_ctime and st_mtime fields of the file and the S_ISUID and S_ISGID bits of the file mode may be cleared. If the ftruncate() function is unsuccessful, the file is unaffected. The open(O_TRUNC) and truncate cases were being handled correctly, but the ftruncate case was being handled like the truncate case. The semantics of truncate and ftruncate don't quite match, so ftruncate needs to be handled slightly differently. The attached patch addresses this issue for ftruncate(2). My thanx to Stephen Tweedie and Trond Myklebust for their help in understanding the situation and semantics. Signed-off-by: Peter Staubach <staubach@redhat.com> Cc: "Stephen C. Tweedie" <sct@redhat.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/inotify.c')
0 files changed, 0 insertions, 0 deletions