summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2019-08-08 14:29:54 -0400
committerAndreas Gruenbacher <agruenba@redhat.com>2019-09-03 03:41:42 -0400
commit0a6a4abc84668d102c8f0380c9bcb93eb87fa4b6 (patch)
treef0f345f061b175ab36df088d142995173689c6d3
parentd40312598d534c17c17f41c2bb7ce9541a5f786e (diff)
gfs2: Always mark inode dirty in fallocate
When allocating space with fallocate, always update the file timestamps and mark the inode dirty, no matter if the FALLOC_FL_KEEP_SIZE flag is set or not. The inode needs to be marked dirty so that a subsequent fsync will pick it up and any new allocations will make it to disk. Filesystems like xfs and ext4 always update the timestamps, so make gfs2 behave the same way. Fixes xfstest generic/483. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r--fs/gfs2/file.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 52fa1ef8400b..99e2c8cd5eaa 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1065,11 +1065,10 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
1065 gfs2_quota_unlock(ip); 1065 gfs2_quota_unlock(ip);
1066 } 1066 }
1067 1067
1068 if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size) { 1068 if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size)
1069 i_size_write(inode, pos + count); 1069 i_size_write(inode, pos + count);
1070 file_update_time(file); 1070 file_update_time(file);
1071 mark_inode_dirty(inode); 1071 mark_inode_dirty(inode);
1072 }
1073 1072
1074 if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host)) 1073 if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
1075 return vfs_fsync_range(file, pos, pos + count - 1, 1074 return vfs_fsync_range(file, pos, pos + count - 1,