From 54028ab8e7bba6be153fda64cb8603b493f971c8 Mon Sep 17 00:00:00 2001 From: yury <yury> Date: Wed, 11 May 2005 10:49:21 +0000 Subject: [PATCH] - more fixes and comments about intent managing in ll_revalidate_it(). In few words, in the cases dentry is valid and no lookup will be called anymore, intent may be released by ll_intent_release() with clobering -._magic, ->it_op, etc, as it will not be used anymore. In the case revalidate failed, intent should not clobber ->magic, as it will confuse ll_frob_intent() called from ll_lookup_it(). Instead ll_drop_intent_lock() and ll_intent_free() should be used. - in the case we found potential GNS dentry we do not cause GNS mountining by returning 0 from revalidate if GNS is disabled. This fixes possible NFS stales in some cases. --- lustre/llite/dcache.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 23c49aae9c..00da5d0a2d 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -510,9 +510,24 @@ out: } if (rc == 0) { - if (it == &lookup_it) + if (it == &lookup_it) { + /* + * releasing intent with cloberring ->magic etc. as this + * is our @lookup_it which will not be used out of this + * function. --umka + */ ll_intent_release(it); - + } else { + /* + * as dentry is not revalidated, ll_llokup_it() me be + * called. Thus we should make sure that lock is dropped + * and intent freed without clobbering ->magic, etc. We + * free intent allocated in ll__frob_intent() called in + * this function. --umka + */ + ll_intent_drop_lock(it); + ll_intent_free(it); + } ll_unhash_aliases(de->d_inode); return 0; } @@ -524,7 +539,7 @@ out: * lookup control path, which is always made with parent's i_sem taken. * --umka */ - if (rc && + if (rc && atomic_read(&ll_i2sbi(de->d_inode)->ll_gns_enabled) && !(!((de->d_inode->i_mode & S_ISUID) && S_ISDIR(de->d_inode->i_mode)) || !(flags & LOOKUP_CONTINUE || (gns_it & (IT_CHDIR | IT_OPEN))))) { /* @@ -534,7 +549,7 @@ out: if (!ll_special_name(de)) { /* * releasing intent for lookup case as @it in this time - * our private it and will not be used anymore in thois + * our private it and will not be used anymore in this * control path. --umka */ if (it == &lookup_it) { @@ -563,9 +578,11 @@ out: de->d_flags &= ~DCACHE_LUSTRE_INVALID; /* - * this should be released with no check for @lookup_it. In the case it - * is not @lookup_it we're freeing LUSTRE_IT(it) where @it passed to us - * and allocated in ll_frob_intent(). --umka + * here @it should be released in both cases, as in the case @it is not + * @lookup_it we release intent allocated in ll_frob_intent(). Here we + * can use ll_intent_release() which also clobers ->magic as dentry is + * revalidated and this intent will not be passed to ll_lookup_it() and + * will not confuse it. --umka */ ll_intent_release(it); return rc; -- GitLab