From: Oleg Drokin Date: Thu, 2 May 2013 04:50:24 +0000 (-0400) Subject: LU-2924 Make quota namespace refcounting consistent X-Git-Tag: 2.4.51~42 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=716ff602a3edd1597d0f1a658d2d63398463e0c2;p=fs%2Flustre-release.git LU-2924 Make quota namespace refcounting consistent It seems quota namespace is needlessly referenced on connect, but that's not necessary as it could not go away until entire obd goes away. On the other hand this extra reference disturbs other logic depending on empty namespace having zero refcount, so this patch drops such extra referencing. Change-Id: I62e04ef01a3673e4ffadc4204f3e1768e44fed18 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/6234 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Johann Lombardi --- diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index 36ce175..cb46c31 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -84,8 +84,7 @@ static inline struct mutex *ldlm_namespace_lock(ldlm_side_t client) &ldlm_srv_namespace_lock : &ldlm_cli_namespace_lock; } -/* ns_bref is the number of resources in this namespace with the notable - * exception of quota namespaces which have their empty refcount at 1 */ +/* ns_bref is the number of resources in this namespace */ static inline int ldlm_ns_empty(struct ldlm_namespace *ns) { return cfs_atomic_read(&ns->ns_bref) == 0; diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index d4a2bed..aba0903 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -1210,11 +1210,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, /* Let's see if we happened to be the very first resource in this * namespace. If so, and this is a client namespace, we need to move * the namespace into the active namespaces list to be patrolled by - * the ldlm_poold. - * A notable exception, for quota namespaces qsd_lib.c already took a - * namespace reference, so it won't be participating in all of this, - * but I guess that's ok since we have no business cancelling quota - * locks anyway */ + * the ldlm_poold. */ if (ns_is_client(ns) && ns_refcount == 1) { mutex_lock(ldlm_namespace_lock(LDLM_NAMESPACE_CLIENT)); ldlm_namespace_move_to_active_locked(ns, LDLM_NAMESPACE_CLIENT); diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c index b1a29b1..7623aa7 100644 --- a/lustre/quota/qsd_lib.c +++ b/lustre/quota/qsd_lib.c @@ -235,8 +235,6 @@ static int qsd_conn_callback(void *data) /* qsd_exp should now be valid */ LASSERT(qsd->qsd_exp); - /* grab reference on namespace */ - ldlm_namespace_get(class_exp2obd(qsd->qsd_exp)->obd_namespace); qsd->qsd_ns = class_exp2obd(qsd->qsd_exp)->obd_namespace; write_lock(&qsd->qsd_lock); @@ -475,9 +473,7 @@ void qsd_fini(const struct lu_env *env, struct qsd_instance *qsd) qsd_stop_reint_thread(qsd->qsd_type_array[qtype]); } - /* release reference on namespace */ if (qsd->qsd_ns != NULL) { - ldlm_namespace_put(qsd->qsd_ns); qsd->qsd_ns = NULL; }