Commit 33713cd0 authored by Martin Brandenburg's avatar Martin Brandenburg Committed by Mike Marshall

orangefs: truncate before updating size

Otherwise we race with orangefs_writepage/orangefs_writepages
which and does not expect i_size < page_offset.

Fixes xfstests generic/129.
Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent dd59a647
......@@ -818,7 +818,11 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
}
orig_size = i_size_read(inode);
truncate_setsize(inode, iattr->ia_size);
/* This is truncate_setsize in a different order. */
truncate_pagecache(inode, iattr->ia_size);
i_size_write(inode, iattr->ia_size);
if (iattr->ia_size > orig_size)
pagecache_isize_extended(inode, orig_size, iattr->ia_size);
new_op = op_alloc(ORANGEFS_VFS_OP_TRUNCATE);
if (!new_op)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment