Whamcloud - gitweb
LU-13456 ldlm: fix reprocessing of locks with more bits
[fs/lustre-release.git] / lustre / include / lustre_dlm.h
index b1a9eae..ee4dea1 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 /** \defgroup LDLM Lustre Distributed Lock Manager
@@ -783,13 +782,10 @@ struct ldlm_lock {
         */
        struct portals_handle   l_handle;
        /**
-        * Internal spinlock protects l_resource.  We should hold this lock
-        * first before taking res_lock.
-        */
-       spinlock_t              l_lock;
-       /**
         * Pointer to actual resource this lock is in.
-        * ldlm_lock_change_resource() can change this.
+        * ldlm_lock_change_resource() can change this on the client.
+        * When this is possible, rcu must be used to stablise
+        * the resource while we lock and check it hasn't been changed.
         */
        struct ldlm_resource    *l_resource;
        /**
@@ -1061,9 +1057,13 @@ struct ldlm_resource {
 
        /**
         * List item for list in namespace hash.
-        * protected by ns_lock
+        * protected by ns_lock.
+        * Shared with linkage for RCU-delayed free.
         */
-       struct hlist_node       lr_hash;
+       union {
+               struct hlist_node       lr_hash;
+               struct rcu_head         lr_rcu;
+       };
 
        /** Reference count for this resource */
        atomic_t                lr_refcount;
@@ -1222,7 +1222,7 @@ static inline int ldlm_lvbo_fill(struct ldlm_lock *lock, void *buf, int *len)
                /* init lvb now if not already */
                rc = ldlm_lvbo_init(lock->l_resource);
                if (rc < 0) {
-                       CERROR("lock %p: delayed lvb init failed (rc %d)",
+                       CERROR("lock %p: delayed lvb init failed (rc %d)\n",
                               lock, rc);
                        return rc;
                }
@@ -1361,7 +1361,7 @@ typedef int (*ldlm_reprocessing_policy)(struct ldlm_resource *res,
                                        struct list_head *queue,
                                        struct list_head *work_list,
                                        enum ldlm_process_intention intention,
-                                       struct ldlm_lock *hint);
+                                       __u64 hint);
 
 /**
  * Return values for lock iterators.
@@ -1612,7 +1612,7 @@ enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh,
                                           __u64 *bits);
 void ldlm_lock_mode_downgrade(struct ldlm_lock *lock, enum ldlm_mode new_mode);
 void ldlm_lock_cancel(struct ldlm_lock *lock);
-void ldlm_reprocess_all(struct ldlm_resource *res, struct ldlm_lock *hint);
+void ldlm_reprocess_all(struct ldlm_resource *res, __u64 hint);
 void ldlm_reprocess_recovery_done(struct ldlm_namespace *ns);
 void ldlm_lock_dump_handle(int level, const struct lustre_handle *lockh);
 void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);