Commit d1adbf38 authored by Hans Reiser's avatar Hans Reiser Committed by Linus Torvalds

[PATCH] 08-truncate_update_mtime.diff

   truncate now correctly sets mtime always. Before this fix, mtime was not
   updated if truncated file was of zero length or if new filesize was bigger
   then old.
   Problem was noticed by Matthias Andree <ma@dt.e-technik.uni-dortmund.de>
parent fb90f8c2
...@@ -1705,8 +1705,7 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th, ...@@ -1705,8 +1705,7 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
} }
if ( n_file_size == 0 || n_file_size < n_new_file_size ) { if ( n_file_size == 0 || n_file_size < n_new_file_size ) {
pathrelse(&s_search_path); goto update_and_out ;
return;
} }
/* Update key to search for the last file item. */ /* Update key to search for the last file item. */
...@@ -1759,6 +1758,7 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th, ...@@ -1759,6 +1758,7 @@ void reiserfs_do_truncate (struct reiserfs_transaction_handle *th,
"PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d\n", "PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d\n",
n_new_file_size, n_file_size, s_item_key.on_disk_key.k_objectid); n_new_file_size, n_file_size, s_item_key.on_disk_key.k_objectid);
update_and_out:
if (update_timestamps) { if (update_timestamps) {
// this is truncate, not file closing // this is truncate, not file closing
p_s_inode->i_mtime = p_s_inode->i_ctime = CURRENT_TIME; p_s_inode->i_mtime = p_s_inode->i_ctime = CURRENT_TIME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment