Skip to contentSkip to conversation

GFS2: fallocate: do not rely on file_update_time to mark the inode dirty

PATCH New Andrew Price 2 participants 2 messages Sep 22, 2015 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GFS2: fallocate: do not rely on file_update_time to mark the inode dirty

Previously __gfs2_fallocate() relied on file_update_time() marking the inode dirty, but that's not a safe assumption as that function doesn't dirty the inode in some cases. Mark the inode dirty explicitly.

---
 fs/gfs2/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/file.c +1 -1
index cf4ab89..71cd138 100644
@@ -897,8 +897,8 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
 
 	if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size) {
 		i_size_write(inode, pos + count);
-		/* Marks the inode as dirty */
 		file_update_time(file);
+		mark_inode_dirty(inode);
 	}
 
 	return generic_write_sync(file, pos, count);
Signature · 1 line
2.4.3
#1 lore raw

PATCH 1/1 GFS2: fallocate: do not rely on file_update_time to mark the inode dirty

----- Original Message -----

Quoted 25 lines

Previously __gfs2_fallocate() relied on file_update_time() marking the inode dirty, but that's not a safe assumption as that function doesn't dirty the inode in some cases. Mark the inode dirty explicitly.

---
 fs/gfs2/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/file.c +0 -0
index cf4ab89..71cd138 100644
@@ -897,8 +897,8 @@ static long __gfs2_fallocate(struct file *file, int mode,

loff_t offset, loff_t

fs/gfs2/file.c +1 -2
 	if (!(mode & FALLOC_FL_KEEP_SIZE) && (pos + count) > inode->i_size) {
 		i_size_write(inode, pos + count);
-		/* Marks the inode as dirty */
 		file_update_time(file);
+		mark_inode_dirty(inode);
 	}
 
 	return generic_write_sync(file, pos, count);
--
Quoted 1 line

2.4.3

Hi,

Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=4b813f09405823dcbb27a434f6ddcd1741e55e9b

Regards,

Bob Peterson
Red Hat File Systems