Skip to contentSkip to conversation

gfs2: Always mark inode dirty in fallocate

PATCH New Andreas Gruenbacher 1 participant 1 message Aug 8, 2019 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 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 set or not. The inode needs to be marked dirty so that a subsequent fsync will pick up the inode, 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 fstest generic/483.

---
 fs/gfs2/file.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
fs/gfs2/file.c +3 -4
index 52fa1ef8400b..99e2c8cd5eaa 100644
@@ -1065,11 +1065,10 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
 		gfs2_quota_unlock(ip);
 	}
 
-	if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size) {
+	if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size)
 		i_size_write(inode, pos + count);
-		file_update_time(file);
-		mark_inode_dirty(inode);
-	}
+	file_update_time(file);
+	mark_inode_dirty(inode);
 
 	if ((file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host))
 		return vfs_fsync_range(file, pos, pos + count - 1,
Signature · 1 line
2.20.1