From ec900fc028b3c811ec07a80b9ceca5414b71c947 Mon Sep 17 00:00:00 2001 From: shadow Date: Mon, 8 Sep 2008 08:55:44 +0000 Subject: [PATCH] add workaround for race in dcache with patchless client. Branch b1_8_gate b=15975 i=johann i=adilger --- lustre/llite/namei.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index a49b9ab..9206791 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -148,6 +148,7 @@ static void ll_drop_negative_dentry(struct inode *dir) { struct dentry *dentry, *tmp_alias, *tmp_subdir; + spin_lock(&ll_lookup_lock); spin_lock(&dcache_lock); restart: list_for_each_entry_safe(dentry, tmp_alias, @@ -168,6 +169,7 @@ restart: } } spin_unlock(&dcache_lock); + spin_unlock(&ll_lookup_lock); } int ll_mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, @@ -376,6 +378,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de) struct dentry *dentry; struct dentry *last_discon = NULL; + spin_lock(&ll_lookup_lock); spin_lock(&dcache_lock); list_for_each(tmp, &inode->i_dentry) { dentry = list_entry(tmp, struct dentry, d_alias); @@ -414,6 +417,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de) unlock_dentry(dentry); d_rehash_cond(dentry, 0); /* avoid taking dcache_lock inside */ spin_unlock(&dcache_lock); + spin_unlock(&ll_lookup_lock); iput(inode); CDEBUG(D_DENTRY, "alias dentry %.*s (%p) parent %p inode %p " "refc %d\n", de->d_name.len, de->d_name.name, de, @@ -428,6 +432,8 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de) spin_unlock(&dcache_lock); d_rehash(de); d_move(last_discon, de); + spin_unlock(&ll_lookup_lock); + iput(inode); return last_discon; } @@ -435,6 +441,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *de) ll_d_add(de, inode); spin_unlock(&dcache_lock); + spin_unlock(&ll_lookup_lock); return de; } -- 1.8.3.1