Please don't reply to lustre-devel. Instead, comment in Bugzilla by using the 
following link:
https://bugzilla.lustre.org/show_bug.cgi?id=11301

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #9359|review?([EMAIL PROTECTED])|review-
               Flag|                            |


(From update of attachment 9359)
> int ldlm_run_bl_ast_work(struct list_head *rpc_list)
> {
>+        struct ldlm_cb_set_arg arg;
>         struct list_head *tmp, *pos;
>         struct ldlm_lock_desc d;
>-        int rc = 0, retval = 0;
>+        int ast_count;
>+        int rc = 0;
>         ENTRY;
> 
>+        arg.set = ptlrpc_prep_set();
>+        atomic_set(&arg.restart, 0);
>+        arg.type = LDLM_BL_CALLBACK;
>+
>+        ast_count = 0;
>         list_for_each_safe(tmp, pos, rpc_list) {
>                 struct ldlm_lock *lock =
>                         list_entry(tmp, struct ldlm_lock, l_bl_ast);
>@@ -1051,24 +1076,38 @@ int ldlm_run_bl_ast_work(struct list_hea
> 
>                 LDLM_LOCK_PUT(lock->l_blocking_lock);
>                 lock->l_blocking_lock = NULL;
>-                rc = lock->l_blocking_ast(lock, &d, NULL, LDLM_CB_BLOCKING);
>-
>-                if (rc == -ERESTART)
>-                        retval = rc;
>-                else if (rc)
>-                        CDEBUG(D_DLMTRACE, "Failed AST - should clean & "
>-                               "disconnect client\n");
>+                rc = lock->l_blocking_ast(lock, &d, (void *)&arg, 
>+                                          LDLM_CB_BLOCKING);
>                 LDLM_LOCK_PUT(lock);
>+                ast_count++;
>+
>+                /* Send the request set if it exceeds the PARALLEL_AST_LIMIT,
>+                 * and create a new set for requests that remained in
>+                 * @rpc_list */
>+                if (unlikely(ast_count == PARALLEL_AST_LIMIT)) {
>+                        ldlm_send_and_maybe_create_set(&arg, 1);
>+                        ast_count = 0;
>+                }
>         }
>-        RETURN(retval);
>+
>+        if (ast_count > 0)

Note that if you get here with count 0 (e.g. if there were exactly
PARALLEL_AST_LIMIT asts to send,
then you leak memory allocated to request.

>+                ldlm_send_and_maybe_create_set(&arg, 0);
>+
>+        RETURN(atomic_read(&arg.restart) ? -ERESTART : 0);
> }
> 
> int ldlm_run_cp_ast_work(struct list_head *rpc_list)

Same as above wrt leaking memory.

_______________________________________________
Lustre-devel mailing list
[email protected]
https://mail.clusterfs.com/mailman/listinfo/lustre-devel

Reply via email to