[Ocfs2-devel] [patch 10/11] ocfs2: fix issue that ocfs2_setattr() does not deal with new_i_size==i_size

Mark Fasheh mfasheh at suse.de
Mon Feb 10 13:14:14 PST 2014


On Fri, Jan 24, 2014 at 12:47:10PM -0800, akpm at linux-foundation.org wrote:
> From: Younger Liu <younger.liu at huawei.com>
> Subject: ocfs2: fix issue that ocfs2_setattr() does not deal with new_i_size==i_size
> 
> The issue scenario is as following:
> 
> - Create a small file and fallocate a large disk space for a file with
>   FALLOC_FL_KEEP_SIZE option.
> 
> - ftruncate the file back to the original size again.  but the disk free
>   space is not changed back.  This is a real bug that be fixed in this
>   patch.
> 
> In order to solve the issue above, we modified ocfs2_setattr(), if
> attr->ia_size != i_size_read(inode), It calls ocfs2_truncate_file(), and
> truncate disk space to attr->ia_size.
> 
> Signed-off-by: Younger Liu <younger.liu at huawei.com>
> Reviewed-by: Jie Liu <jeff.liu at oracle.com>
> Tested-by: Jie Liu <jeff.liu at oracle.com>
> Cc: Joel Becker <jlbec at evilplan.org>
> Cc: Mark Fasheh <mfasheh at suse.com>
> Cc: Sunil Mushran <sunil.mushran at gmail.com>
> Reviewed-by: Jensen <shencanquan at huawei.com>
> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>

This looks good, thanks for the fix Younger.
	--Mark

Reviewed-by: Mark Fasheh <mfasheh at suse.de>

--
Mark Fasheh



More information about the Ocfs2-devel mailing list