summaryrefslogtreecommitdiff
path: root/fs/orangefs
diff options
context:
space:
mode:
authorMartin Brandenburg <martin@omnibond.com>2019-04-29 20:09:48 +0300
committerMike Marshall <hubcap@omnibond.com>2019-05-03 21:39:10 +0300
commit33713cd09ccdc1e01b10d0782ae60200d4989553 (patch)
tree00fcddbe2e98e1aa7d5cbff2794c08f1ce3903cb /fs/orangefs
parentdd59a6475c4cf69afac2ade01ab732b7825a2a45 (diff)
downloadlinux-33713cd09ccdc1e01b10d0782ae60200d4989553.tar.xz
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: Martin Brandenburg <martin@omnibond.com> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/inode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 3fb671dab81d..0c337d8bdaab 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -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)