Whamcloud - gitweb
LU-13456 ldlm: fix reprocessing of locks with more bits
[fs/lustre-release.git] / lustre / ldlm / ldlm_flock.c
index 92f7aa5..76b2487 100644 (file)
@@ -31,7 +31,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 /**
@@ -364,13 +363,13 @@ reprocess:
                                continue;
 
                        if (intention != LDLM_PROCESS_ENQUEUE) {
-                               reprocess_failed = 1;
                                if (ldlm_flock_deadlock(req, lock)) {
                                        ldlm_flock_cancel_on_deadlock(
                                                req, grant_work);
                                        RETURN(LDLM_ITER_CONTINUE);
                                }
-                               continue;
+                               reprocess_failed = 1;
+                               break;
                        }
 
                        if (*flags & LDLM_FL_BLOCK_NOWAIT) {
@@ -605,7 +604,7 @@ reprocess:
 restart:
                                ldlm_reprocess_queue(res, &res->lr_waiting,
                                                     &rpc_list,
-                                                    LDLM_PROCESS_RESCAN, NULL);
+                                                    LDLM_PROCESS_RESCAN, 0);
 
                                unlock_res_and_lock(req);
                                rc = ldlm_run_ast_work(ns, &rpc_list,
@@ -655,7 +654,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
 {
        struct file_lock *getlk = lock->l_ast_data;
        struct obd_device *obd;
-       struct obd_import *imp = NULL;
        enum ldlm_error err;
        int rc = 0;
        ENTRY;
@@ -688,10 +686,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)
                   "client-side enqueue returned a blocked lock, sleeping");
        obd = class_exp2obd(lock->l_conn_export);
 
-       /* if this is a local lock, there is no import */
-       if (obd)
-               imp = obd->u.cli.cl_import;
-
        /* Go to sleep until the lock is granted. */
        rc = l_wait_event_abortable(lock->l_waitq,
                                    is_granted_or_cancelled(lock));
@@ -763,7 +757,7 @@ granted:
                if (ldlm_is_test_lock(lock) || ldlm_is_flock_deadlock(lock))
                        mode = getlk->fl_type;
                else
-                       mode = lock->l_granted_mode;
+                       mode = lock->l_req_mode;
 
                if (ldlm_is_flock_deadlock(lock)) {
                        LDLM_DEBUG(lock, "client-side enqueue deadlock "