From e4cdf229e0ccd557d6d1018a2fcc25aaef667277 Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 11 May 2005 10:04:43 +0000 Subject: [PATCH] - fixes in ll_revalidate_it() about correct allocating/releasing intents. - added comments about all the changes. Added comment for some GNS related cases. - in the GNS case lookup intent should be released and others should be dropped and freed. --- lustre/llite/dcache.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index efd02c0..23c49aa 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -369,6 +369,12 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd, /* If there was no lookup lock, no point in even checking for UPDATE lock */ if (!rc) { + /* + * freeing @it allocated in ll_frob_intent() above in + * this function before replacing @it by @lookup_it and + * thus lossing it. --umka + */ + ll_intent_free(it); it = &lookup_it; if (!req) { ll_intent_free(it); @@ -377,6 +383,12 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd, GOTO(out, rc); } if (it_disposition(&lookup_it, DISP_LOOKUP_NEG)) { + /* + * freeing @it allocated in ll_frob_intent() above in + * this function before replacing @it by @lookup_it and + * thus lossing it. --umka + */ + ll_intent_free(it); it = &lookup_it; ll_intent_free(it); GOTO(out, rc = 0); @@ -438,6 +450,12 @@ int ll_revalidate_it(struct dentry *de, int flags, struct nameidata *nd, memcpy(&LUSTRE_IT(it)->it_lock_handle, &lockh, sizeof(lockh)); LUSTRE_IT(it)->it_lock_mode = lockmode; + + /* + * we do not check here for possible GNS dentry as if + * file is opened on it, it is mounted already and we do + * not need do anything. --umka + */ RETURN(1); } else { /* Hm, interesting. Lock is present, but no open @@ -514,8 +532,23 @@ out: * they never should be passed to lookup() */ if (!ll_special_name(de)) { - ll_intent_drop_lock(it); - ll_intent_free(it); + /* + * releasing intent for lookup case as @it in this time + * our private it and will not be used anymore in thois + * control path. --umka + */ + if (it == &lookup_it) { + ll_intent_release(it); + } else { + /* + * dropping lock and freeing intent allocated in + * ll_frob_intent(). Do not release it (that is + * do not put it->magic to 0), as it will be + * used later by ll_lookup_it(). --umka + */ + ll_intent_drop_lock(it); + ll_intent_free(it); + } ll_unhash_aliases(de->d_inode); return 0; } @@ -528,8 +561,13 @@ out: ll_lookup_finish_locks(it, de); de->d_flags &= ~DCACHE_LUSTRE_INVALID; - if (it == &lookup_it) - ll_intent_release(it); + + /* + * 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 + */ + ll_intent_release(it); return rc; do_lookup: it = &lookup_it; -- 1.8.3.1