Whamcloud - gitweb
LU-9679 lustre: use LIST_HEAD() for local lists.
[fs/lustre-release.git] / lustre / obdclass / genops.c
index 0d670da..aca1fec 100644 (file)
@@ -899,7 +899,7 @@ out:
        RETURN(rc);
 }
 
-static struct portals_handle_ops export_handle_ops;
+static const char export_handle_owner[] = "export";
 
 /* map connection to client */
 struct obd_export *class_conn2export(struct lustre_handle *conn)
@@ -918,7 +918,7 @@ struct obd_export *class_conn2export(struct lustre_handle *conn)
         }
 
        CDEBUG(D_INFO, "looking for export cookie %#llx\n", conn->cookie);
-       export = class_handle2object(conn->cookie, &export_handle_ops);
+       export = class_handle2object(conn->cookie, export_handle_owner);
        RETURN(export);
 }
 EXPORT_SYMBOL(class_conn2export);
@@ -971,10 +971,6 @@ static void class_export_destroy(struct obd_export *exp)
         EXIT;
 }
 
-static struct portals_handle_ops export_handle_ops = {
-       .hop_type       = "export",
-};
-
 struct obd_export *class_export_get(struct obd_export *exp)
 {
        refcount_inc(&exp->exp_handle.h_ref);
@@ -1060,10 +1056,10 @@ struct obd_export *__class_new_export(struct obd_device *obd,
        spin_lock_init(&export->exp_uncommitted_replies_lock);
        INIT_LIST_HEAD(&export->exp_uncommitted_replies);
        INIT_LIST_HEAD(&export->exp_req_replay_queue);
-       INIT_LIST_HEAD_RCU(&export->exp_handle.h_link);
+       INIT_HLIST_NODE(&export->exp_handle.h_link);
        INIT_LIST_HEAD(&export->exp_hp_rpcs);
        INIT_LIST_HEAD(&export->exp_reg_rpcs);
-       class_handle_hash(&export->exp_handle, &export_handle_ops);
+       class_handle_hash(&export->exp_handle, export_handle_owner);
        export->exp_last_request_time = ktime_get_real_seconds();
        spin_lock_init(&export->exp_lock);
        spin_lock_init(&export->exp_rpc_lock);
@@ -1271,7 +1267,7 @@ struct obd_import *class_new_import(struct obd_device *obd)
        init_waitqueue_head(&imp->imp_recovery_waitq);
        INIT_WORK(&imp->imp_zombie_work, obd_zombie_imp_cull);
 
-       if (curr_pid_ns->child_reaper)
+       if (curr_pid_ns && curr_pid_ns->child_reaper)
                imp->imp_sec_refpid = curr_pid_ns->child_reaper->pid;
        else
                imp->imp_sec_refpid = 1;
@@ -1524,11 +1520,10 @@ static void class_disconnect_export_list(struct list_head *list,
 
 void class_disconnect_exports(struct obd_device *obd)
 {
-       struct list_head work_list;
+       LIST_HEAD(work_list);
        ENTRY;
 
        /* Move all of the exports from obd_exports to a work list, en masse. */
-       INIT_LIST_HEAD(&work_list);
        spin_lock(&obd->obd_dev_lock);
        list_splice_init(&obd->obd_exports, &work_list);
        list_splice_init(&obd->obd_delayed_exports, &work_list);
@@ -1551,12 +1546,11 @@ EXPORT_SYMBOL(class_disconnect_exports);
 void class_disconnect_stale_exports(struct obd_device *obd,
                                     int (*test_export)(struct obd_export *))
 {
-       struct list_head work_list;
+       LIST_HEAD(work_list);
        struct obd_export *exp, *n;
-        int evicted = 0;
-        ENTRY;
+       int evicted = 0;
+       ENTRY;
 
-       INIT_LIST_HEAD(&work_list);
        spin_lock(&obd->obd_dev_lock);
        list_for_each_entry_safe(exp, n, &obd->obd_exports,
                                 exp_obd_chain) {
@@ -2283,8 +2277,8 @@ __u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc)
                        spin_unlock(&cli->cl_mod_rpcs_lock);
                        /* tag 0 is reserved for non-modify RPCs */
 
-                       CDEBUG(D_RPCTRACE, "%s: modify RPC slot %u is allocated"
-                              "opc %u, max %hu\n",
+                       CDEBUG(D_RPCTRACE,
+                              "%s: modify RPC slot %u is allocated opc %u, max %hu\n",
                               cli->cl_import->imp_obd->obd_name,
                               i + 1, opc, max);