Whamcloud - gitweb
- Don't shutdown the LDLM if other modules still have namespaces
authorpschwan <pschwan>
Thu, 8 Aug 2002 09:15:25 +0000 (09:15 +0000)
committerpschwan <pschwan>
Thu, 8 Aug 2002 09:15:25 +0000 (09:15 +0000)
- force cleanup of open MDS exports
- added class_disconnect_all() to that end

lustre/README
lustre/include/linux/obd_class.h
lustre/ldlm/ldlm_lockd.c
lustre/mds/handler.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c

index 3708ef2..a7b7240 100644 (file)
@@ -5,4 +5,4 @@ If you have checked lustre directly out of CVS, then you either need to
 get lyx to build the lustre-HOWTO.txt from the source file, get the PDF
 version from the lustre.org website, or install the lustre-doc RPM for
 the formatted text version (or read the somewhat cryptic lustre-HOWTO.lin
-file if you are desparate).
+file if you are desperate).
index f76dd84..2298cd6 100644 (file)
@@ -713,6 +713,7 @@ struct obd_export *class_new_export(struct obd_device *obddev);
 int class_connect(struct lustre_handle *conn, struct obd_device *obd,
                   char *cluuid);
 int class_disconnect(struct lustre_handle *conn);
+void class_disconnect_all(struct obd_device *obddev);
 struct obd_export *class_conn2export(struct lustre_handle *);
 
 /* generic operations shared by various OBD types */
index aa45e1f..0848a0f 100644 (file)
@@ -18,6 +18,7 @@
 
 extern kmem_cache_t *ldlm_resource_slab;
 extern kmem_cache_t *ldlm_lock_slab;
+extern struct list_head ldlm_namespace_list;
 extern int (*mds_reint_p)(int offset, struct ptlrpc_request *req);
 extern int (*mds_getattr_name_p)(int offset, struct ptlrpc_request *req);
 
@@ -478,6 +479,11 @@ static int ldlm_cleanup(struct obd_device *obddev)
         struct ldlm_obd *ldlm = &obddev->u.ldlm;
         ENTRY;
 
+        if (!list_empty(&ldlm_namespace_list)) {
+                CERROR("ldlm still has namespaces; clean these up first.\n");
+                RETURN(-EBUSY);
+        }
+
         ptlrpc_stop_all_threads(ldlm->ldlm_service);
         ptlrpc_unregister_service(ldlm->ldlm_service);
         ldlm_proc_cleanup(obddev);
index 8b55d65..5362336 100644 (file)
@@ -1093,16 +1093,20 @@ err_dec:
         return rc;
 }
 
-static int mds_cleanup(struct obd_device * obddev)
+static int mds_cleanup(struct obd_device *obddev)
 {
         struct super_block *sb;
         struct mds_obd *mds = &obddev->u.mds;
 
         ENTRY;
 
-        if ( !list_empty(&obddev->obd_exports) ) {
-                CERROR("still has exports!\n");
-                RETURN(-EBUSY);
+        if (!list_empty(&obddev->obd_exports)) {
+                CERROR("still has exports; forcing cleanup\n");
+                class_disconnect_all(obddev);
+                if (!list_empty(&obddev->obd_exports)) {
+                        CERROR("still has exports after forced cleanup?\n");
+                        RETURN(-EBUSY);
+                }
         }
 
         ptlrpc_stop_all_threads(mds->mds_service);
index fe9383e..5139574 100644 (file)
@@ -590,6 +590,7 @@ EXPORT_SYMBOL(class_conn2export);
 EXPORT_SYMBOL(class_rconn2export);
 EXPORT_SYMBOL(class_conn2obd);
 EXPORT_SYMBOL(class_disconnect);
+EXPORT_SYMBOL(class_disconnect_all);
 //EXPORT_SYMBOL(class_multi_setup);
 //EXPORT_SYMBOL(class_multi_cleanup);
 
index 29cdbc1..a58cd21 100644 (file)
@@ -341,6 +341,21 @@ int class_disconnect(struct lustre_handle *conn)
         RETURN(0);
 }
 
+void class_disconnect_all(struct obd_device *obddev)
+{
+        struct list_head *tmp, *next;
+
+        list_for_each_safe(tmp, next, &obddev->obd_exports) {
+                struct obd_export *export;
+                struct lustre_handle conn;
+
+                export = list_entry(tmp, struct obd_export, exp_chain);
+                conn.addr = (__u64) (unsigned long)export;
+                conn.cookie = export->exp_cookie;
+                obd_disconnect(&conn);
+        }
+}
+
 #if 0
 
 /* FIXME: Data is a space- or comma-separated list of device IDs.  This will