From 494a3bbc66ddb91ac2620d6099ddd351a96f70d7 Mon Sep 17 00:00:00 2001 From: wangdi Date: Thu, 19 Apr 2007 10:01:20 +0000 Subject: [PATCH] Branch:HEAD b:12123 Check if a directory has children when invalidating dentries associated with an inode during lock cancellation. This fixes an incorrect ENOENT sometimes seen for valid filehandles during testing with dbench. r:green r:shadow --- lustre/ChangeLog | 8 ++++++++ lustre/llite/namei.c | 24 +++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 8cdc3d7..2f491b7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -48,6 +48,14 @@ Description: connectathon hang when test nfs export over patchless client Details : Disconnected dentry cannot be found with lookup, so we do not need to unhash it or make it invalid +Severity : normal +Bugzilla : 12123 +Description: ENOENT returned for valid filehandle during dbench. +Details: : Check if a directory has children when invalidating dentries + associated with an inode during lock cancellation. This fixes + an incorrect ENOENT sometimes seen for valid filehandles during + testing with dbench. + -------------------------------------------------------------------------------- tbd Cluster File Systems, Inc. diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 93d063d..4bba5d6 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -209,31 +209,29 @@ int ll_mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if (S_ISDIR(inode->i_mode) && (bits & MDS_INODELOCK_UPDATE)) { struct dentry *dentry, *tmp, *dir; - struct list_head *list; + int alias_counter = 0; CDEBUG(D_INODE, "invalidating inode %lu\n", inode->i_ino); truncate_inode_pages(inode->i_mapping, 0); /* Drop possible cached negative dentries */ - list = &inode->i_dentry; dir = NULL; spin_lock(&dcache_lock); - + /* It is possible to have several dentries (with racer?) */ - while ((list = list->next) != &inode->i_dentry) { - dir = list_entry(list, struct dentry, d_alias); -#ifdef LUSTRE_KERNEL_VERSION - if (!(dir->d_flags & DCACHE_LUSTRE_INVALID)) -#else - if (!d_unhashed(dir)) -#endif - break; - - dir = NULL; + list_for_each_entry_safe(dentry, tmp, + &inode->i_dentry,d_alias) { + if (!list_empty(&dentry->d_subdirs)) + dir = dentry; + alias_counter ++; } + if (alias_counter > 1) + CWARN("More than 1 alias dir %lu alias %d\n", + inode->i_ino, alias_counter); + if (dir) { restart: list_for_each_entry_safe(dentry, tmp, -- 1.8.3.1