[PATCH] First casuality of hlist poisoning in 2.5.70

From: Trond Myklebust (trond.myklebust@fys.uio.no)
Date: Wed Jun 11 2003 - 18:34:25 EST


Hi,

  This patch removes the Oops that occurs when either the source or
the target of a d_move() operation is unhashed. It is currently
triggered by the NFS sillyrename code.

Cheers,
  Trond

--- linux-2.5.70-up/fs/dcache.c.orig 2003-06-07 10:17:01.000000000 -0700
+++ linux-2.5.70-up/fs/dcache.c 2003-06-11 16:11:56.000000000 -0700
@@ -1223,8 +1223,13 @@
         /* Move the dentry to the target hash queue, if on different bucket */
         if (dentry->d_bucket != target->d_bucket) {
                 dentry->d_bucket = target->d_bucket;
- hlist_del_rcu(&dentry->d_hash);
- hlist_add_head_rcu(&dentry->d_hash, target->d_bucket);
+ if (!hlist_unhashed(&dentry->d_hash))
+ hlist_del_rcu(&dentry->d_hash);
+ if (!hlist_unhashed(&target->d_hash)) {
+ hlist_add_head_rcu(&dentry->d_hash, target->d_bucket);
+ dentry->d_vfs_flags &= ~DCACHE_UNHASHED;
+ } else
+ dentry->d_vfs_flags |= DCACHE_UNHASHED;
         }
 
         /* Unhash the target: dput() will then get rid of it */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:30 EST