From dd2ab5d696a2104556fb450ff46cc8f42f9cf285 Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 17 Jul 2003 21:07:19 +0000 Subject: [PATCH] Set mtime and ctime on old inode if truncating by thread. Also, mark the inodes dirty _after_ we modify them (done in orphan_add/del), in case of crash before the real truncate is called. I thought this might be the cause of bug 1530 (deleted files come back to life), but that would not be the case even if there is a problem in the delete thread as the name unlink is done before the delete thread gets involved. --- .../patches/ext3-delete_thread-2.4.18.patch | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/kernel_patches/patches/ext3-delete_thread-2.4.18.patch b/lustre/kernel_patches/patches/ext3-delete_thread-2.4.18.patch index 1223617..95ccc49 100644 --- a/lustre/kernel_patches/patches/ext3-delete_thread-2.4.18.patch +++ b/lustre/kernel_patches/patches/ext3-delete_thread-2.4.18.patch @@ -301,7 +301,7 @@ long latency while truncating very large files. --- linux-2.4.18-18.8.0-l15/fs/ext3/inode.c~ext3-delete_thread-2.4.18 Wed Jul 2 23:13:58 2003 +++ linux-2.4.18-18.8.0-l15-adilger/fs/ext3/inode.c Wed Jul 2 23:50:29 2003 -@@ -2004,6 +2004,117 @@ out_stop: +@@ -2004,6 +2004,118 @@ out_stop: ext3_journal_stop(handle, inode); } @@ -366,15 +366,6 @@ long latency while truncating very large files. + goto out_journal; + } + -+ if (ext3_orphan_add(handle, new_inode) < 0) -+ goto out_journal; -+ -+ if (ext3_orphan_del(handle, old_inode) < 0) { -+ ext3_orphan_del(handle, new_inode); -+ iput(new_inode); -+ goto out_journal; -+ } -+ + nei = EXT3_I(new_inode); + + down_write(&oei->truncate_sem); @@ -386,6 +377,7 @@ long latency while truncating very large files. + + /* FIXME when we do arbitrary truncates */ + old_inode->i_blocks = oei->i_file_acl ? old_inode->i_blksize / 512 : 0; ++ old_inode->i_mtime = old_inode->i_ctime = CURRENT_TIME; + + memcpy(nei->i_data, oei->i_data, sizeof(nei->i_data)); + memset(oei->i_data, 0, sizeof(oei->i_data)); @@ -394,6 +386,15 @@ long latency while truncating very large files. + nei->i_state |= EXT3_STATE_DELETE; + up_write(&oei->truncate_sem); + ++ if (ext3_orphan_add(handle, new_inode) < 0) ++ goto out_journal; ++ ++ if (ext3_orphan_del(handle, old_inode) < 0) { ++ ext3_orphan_del(handle, new_inode); ++ iput(new_inode); ++ goto out_journal; ++ } ++ + ext3_journal_stop(handle, old_inode); + + spin_lock(&sbi->s_delete_lock); -- 1.8.3.1