+ if (*flags != LDLM_FL_WAIT_NOREPROC) {
+#ifdef HAVE_SERVER_SUPPORT
+ if (first_enq) {
+ /* If this is an unlock, reprocess the waitq and
+ * send completions ASTs for locks that can now be
+ * granted. The only problem with doing this
+ * reprocessing here is that the completion ASTs for
+ * newly granted locks will be sent before the unlock
+ * completion is sent. It shouldn't be an issue. Also
+ * note that ldlm_process_flock_lock() will recurse,
+ * but only once because first_enq will be false from
+ * ldlm_reprocess_queue. */
+ if ((mode == LCK_NL) && overlaps) {
+ CFS_LIST_HEAD(rpc_list);
+ int rc;
+restart:
+ ldlm_reprocess_queue(res, &res->lr_waiting,
+ &rpc_list);
+
+ unlock_res_and_lock(req);
+ rc = ldlm_run_ast_work(ns, &rpc_list,
+ LDLM_WORK_CP_AST);
+ lock_res_and_lock(req);
+ if (rc == -ERESTART)
+ GOTO(restart, -ERESTART);
+ }
+ } else {
+ LASSERT(req->l_completion_ast);
+ ldlm_add_ast_work_item(req, NULL, work_list);
+ }
+#else /* !HAVE_SERVER_SUPPORT */
+ /* The only one possible case for client-side calls flock
+ * policy function is ldlm_flock_completion_ast inside which
+ * carries LDLM_FL_WAIT_NOREPROC flag. */
+ CERROR("Illegal parameter for client-side-only module.\n");
+ LBUG();
+#endif /* HAVE_SERVER_SUPPORT */
+ }