Skip to content

Commit

Permalink
ext4: update ctime and mtime for truncate with extents.
Browse files Browse the repository at this point in the history
The recently announced "Linux POSIX file system test suite"
caught a truncate issue when using extents:
mtime and ctime are not updated when truncate is successful.

This is the single issue caught with "default" ext4 (mkfs and mount
with minimal options).
The testsuite does not report failure with -o noextents.

With the following patch, all tests of the testsuite pass.

Signed-off-by: Solofo Ramangalahy <[email protected]>
Signed-off-by: Mingming Cao <[email protected]> 
Signed-off-by: "Theodore Ts'o" <[email protected]>
  • Loading branch information
Solofo Ramangalahy authored and tytso committed Apr 30, 2008
1 parent c83617d commit ef73772
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -2809,6 +2809,8 @@ void ext4_ext_truncate(struct inode * inode, struct page *page)
ext4_orphan_del(handle, inode);

up_write(&EXT4_I(inode)->i_data_sem);
inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
ext4_mark_inode_dirty(handle, inode);
ext4_journal_stop(handle);
}

Expand Down

0 comments on commit ef73772

Please sign in to comment.