]> git.karo-electronics.de Git - karo-tx-linux.git/commit
vfs: increment iversion when a file is truncated
authorDmitry Kasatkin <dmitry.kasatkin@intel.com>
Fri, 9 Nov 2012 03:03:54 +0000 (14:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 12 Nov 2012 04:16:51 +0000 (15:16 +1100)
commit8c59e2fcfc30bc7e0f9d0b80f8b4a8fcb1707395
treef9ad063b4ed635292f8d763821a489af7bc0f61a
parenta7fbc00bce124334d4aabac13353986942247c43
vfs: increment iversion when a file is truncated

When a file is truncated with truncate()/ftruncate() and then closed,
iversion is not updated.  This patch uses ATTR_SIZE flag as an indication
to increment iversion.

Mimi said:

On fput(), i_version is used to detect and flag files that have changed
and need to be re-measured in the IMA measurement policy.  When a file
is truncated with truncate()/ftruncate() and then closed, i_version is
not updated.  As a result, although the file has changed, it will not be
re-measured and added to the IMA measurement list on subsequent access.

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Acked-by: Mimi Zohar <zohar@us.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/attr.c