Whamcloud - gitweb
LU-1940 test: use default resend count for 118c
[fs/lustre-release.git] / lustre / quota / qsd_lock.c
index a21505d..c63d033 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2011, 2012, Intel, Inc.
+ * Copyright (c) 2012, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann.lombardi@intel.com>
@@ -54,16 +54,19 @@ static struct qsd_qtype_info *qsd_glb_ast_data_get(struct ldlm_lock *lock,
        qqi = lock->l_ast_data;
        if (qqi != NULL) {
                qqi_getref(qqi);
-               lu_ref_add(&qqi->qqi_reference, "ast_data_get", lock);
                if (reset)
                        lock->l_ast_data = NULL;
        }
        unlock_res_and_lock(lock);
 
+       if (qqi != NULL)
+               /* it is not safe to call lu_ref_add() under spinlock */
+               lu_ref_add(&qqi->qqi_reference, "ast_data_get", lock);
+
        if (reset && qqi != NULL) {
                /* release qqi reference hold for the lock */
-               qqi_putref(qqi);
                lu_ref_del(&qqi->qqi_reference, "glb_lock", lock);
+               qqi_putref(qqi);
        }
        RETURN(qqi);
 }
@@ -126,6 +129,8 @@ static int qsd_common_glimpse_ast(struct ptlrpc_request *req,
                RETURN(-EFAULT);
 
        /* prepare reply */
+       req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER,
+                            sizeof(struct lquota_lvb));
        rc = req_capsule_server_pack(&req->rq_pill);
        if (rc != 0) {
                CERROR("Can't pack response, rc %d\n", rc);
@@ -241,7 +246,7 @@ static int qsd_glb_glimpse_ast(struct ldlm_lock *lock, void *data)
        /* extract new hard & soft limits from the glimpse descriptor */
        rec.qbr_hardlimit = desc->gl_hardlimit;
        rec.qbr_softlimit = desc->gl_softlimit;
-       rec.qbr_time      = 0;
+       rec.qbr_time      = desc->gl_time;
        rec.qbr_granted   = 0;
 
        /* We can't afford disk io in the context of glimpse callback handling
@@ -470,6 +475,7 @@ int qsd_id_lock_match(struct lustre_handle *lockh, struct lustre_handle *rlockh)
        ldlm_lock_dump_handle(D_QUOTA, lockh);
 
        if (rlockh == NULL)
+               /* caller not interested in remote handle */
                RETURN(0);
 
        /* look up lock associated with local handle and extract remote handle