lkml.org 
[lkml]   [2011]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v3 1/1] vfs: iversion truncate bug fix
From
Date
On Thu, 2011-12-22 at 12:54 +0200, Dmitry Kasatkin wrote:
> 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.
>
> Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>

Acked-by: Mimi Zohar <zohar@us.ibm.com>
(Stable should be cc'ed on this patch.)

thanks,

Mimi

> ---
> fs/attr.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/attr.c b/fs/attr.c
> index 7ee7ba4..b8f55c4 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -176,6 +176,11 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
> return -EPERM;
> }
>
> + if ((ia_valid & ATTR_SIZE) && IS_I_VERSION(inode)) {
> + if (attr->ia_size != inode->i_size)
> + inode_inc_iversion(inode);
> + }
> +
> if ((ia_valid & ATTR_MODE)) {
> mode_t amode = attr->ia_mode;
> /* Flag setting protected by i_mutex */




\
 
 \ /
  Last update: 2011-12-22 14:31    [W:0.071 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site