--- /dev/null
+===== fs/ext3/namei.c 1.52 vs edited =====
+--- 1.52/fs/ext3/namei.c Mon May 10 05:25:34 2004
++++ edited/fs/ext3/namei.c Thu May 20 19:57:10 2004
+@@ -2264,11 +2264,15 @@
+ /*
+ * ok, that's it
+ */
+- retval = ext3_delete_entry(handle, old_dir, old_de, old_bh);
+- if (retval == -ENOENT) {
+- /*
+- * old_de could have moved out from under us.
+- */
++ if (le32_to_cpu(old_de->inode) != old_inode->i_ino ||
++ old_de->name_len != old_dentry->d_name.len ||
++ strncmp(old_de->name, old_dentry->d_name.name, old_de->name_len) ||
++ (retval = ext3_delete_entry(handle, old_dir,
++ old_de, old_bh)) == -ENOENT) {
++ /* old_de could have moved from under us during htree split, so
++ * make sure that we are deleting the right entry. We might
++ * also be pointing to a stale entry in the unused part of
++ * old_bh so just checking inum and the name isn't enough. */
+ struct buffer_head *old_bh2;
+ struct ext3_dir_entry_2 *old_de2;
+