From: yury Date: Fri, 7 Nov 2008 21:10:44 +0000 (+0000) Subject: b=17511 X-Git-Tag: v1_7_140~1^224~1 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1ef50c6f650dcea2204531c2c8f7b19fc526cba3;p=fs%2Flustre-release.git b=17511 r=johann,adilger - removes deadlock possibility by disabling rehash in hash_del() operations and moving hash_add() out of spin_locks when calling. Hash table has own mechanisms for protecting its structures and it also has hash_add_unique() method for using in concurrent run contexts; - fixed missed lh_put() in hash_add_unique() which led to extra refs in some cases (extra ref to export) and inability to cleanup; - fixed __lustre_hash_set_theta() which set @max theta into ->lh_min_theta; - in lustre_hash_rehash_size() disable rehash also for the case when new and old hash sizes equal in corner cases (max_size or min_size). Before this fix it could be possible to do needless rehashes when size is actually did not change but we do this expensive operation; - disable rehash in hash_add_unique() if no actual add happened since entry with the same key is already found in the table; - some cleanups in hash table code; --- diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 913429c..5077f63 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -932,13 +932,11 @@ int target_handle_connect(struct ptlrpc_request *req, svc_handler_t handler) req->rq_self, &remote_uuid); - spin_lock(&target->obd_dev_lock); - /* Export might be hashed already, e.g. if this is reconnect */ - if (hlist_unhashed(&export->exp_nid_hash)) - lustre_hash_add(export->exp_obd->obd_nid_hash, - &export->exp_connection->c_peer.nid, - &export->exp_nid_hash); - spin_unlock(&target->obd_dev_lock); + if (hlist_unhashed(&export->exp_nid_hash)) { + lustre_hash_add_unique(export->exp_obd->obd_nid_hash, + &export->exp_connection->c_peer.nid, + &export->exp_nid_hash); + } if (lustre_msg_get_op_flags(req->rq_repmsg) & MSG_CONNECT_RECONNECT) { revimp = class_import_get(export->exp_imp_reverse);