fuse: fix attributes after open(O_TRUNC)
commita511d35c1e62dca9fe617bcc1bae7d98c996d04b
authorKen Sumrall <ksumrall@android.com>
Wed, 24 Nov 2010 20:57:00 +0000 (24 12:57 -0800)
committerKen Sumrall <ksumrall@android.com>
Thu, 2 Dec 2010 01:17:58 +0000 (1 17:17 -0800)
tree729ac899ded3a674d2ea3440a184e9972e02e956
parent5316236c8da6bf86a15f9e90105e67de4df95200
fuse: fix attributes after open(O_TRUNC)

The attribute cache for a file was not being cleared when a file is opened
with O_TRUNC.

If the filesystem's open operation truncates the file ("atomic_o_trunc"
feature flag is set) then the kernel should invalidate the cached st_mtime
and st_ctime attributes.

Also i_size should be explicitly be set to zero as it is used sometimes
without refreshing the cache.

Signed-off-by: Ken Sumrall <ksumrall@android.com>
Cc: Anfei <anfei.zhou@gmail.com>
Cc: "Anand V. Avati" <avati@gluster.com>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fuse/file.c