- CFS_INIT_LIST_HEAD(&lri->lri_list);
- cfs_list_add(&lri->lri_list, &lwp_register_list);
+ INIT_LIST_HEAD(&lri->lri_list);
+ /*
+ * Initialize the lri_ref at 2, one will be released before
+ * current function returned via lustre_put_lwp_item(), the
+ * other will be released in lustre_deregister_lwp_item().
+ */
+ atomic_set(&lri->lri_ref, 2);
+
+ spin_lock(&lwp_register_list_lock);
+ list_add(&lri->lri_list, &lwp_register_list);
+ spin_unlock(&lwp_register_list_lock);