Whamcloud - gitweb
Mike's fix for the missing exp_connection oops caused us to not remove
authoradilger <adilger>
Fri, 30 Aug 2002 05:16:03 +0000 (05:16 +0000)
committeradilger <adilger>
Fri, 30 Aug 2002 05:16:03 +0000 (05:16 +0000)
old exports from the export list.

It also seems wrong, somehow, to be using a lock on the ptlrpc connection
to manage items that are linked to the obd_device struct.  It would
probably make more sense to protect the export list with a lock on the
obd_device.  This is doubly true, because class_new_export() is adding
the export to the obd_device without holding any lock, because there is
no ptlrpc_connection there yet.

lustre/obdclass/class_obd.c
lustre/obdclass/genops.c

index e396cb6..98af2b0 100644 (file)
@@ -351,13 +351,14 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                         CERROR("OBD device %d still set up\n", obd->obd_minor);
                         GOTO(out, err=-EBUSY);
                 }
-                if (! (obd->obd_flags & OBD_ATTACHED) ) {
+                if (!(obd->obd_flags & OBD_ATTACHED) ) {
                         CERROR("OBD device %d not attached\n", obd->obd_minor);
                         GOTO(out, err=-ENODEV);
                 }
-                if ( !list_empty(&obd->obd_exports) ) {
-                        CERROR("OBD device %d has exports\n",
-                               obd->obd_minor);
+#warning FIXME: Mike, we probably need some sort of "force detach" here
+                if (!list_empty(&obd->obd_exports) ) {
+                        CERROR("OBD device %d (%p) has exports\n",
+                               obd->obd_minor, obd);
                         GOTO(out, err=-EBUSY);
                 }
 
index 0a67f38..00af192 100644 (file)
@@ -285,7 +285,7 @@ struct obd_export *class_new_export(struct obd_device *obddev)
         /* XXX should these be in MDS and LDLM init functions? */
         INIT_LIST_HEAD(&export->exp_mds_data.med_open_head);
         INIT_LIST_HEAD(&export->exp_ldlm_data.led_held_locks);
-        list_add(&(export->exp_chain), &export->exp_obd->obd_exports);
+        list_add(&export->exp_chain, &export->exp_obd->obd_exports);
         return export;
 }
 
@@ -294,11 +294,9 @@ void class_destroy_export(struct obd_export *exp)
         int rc;
         ENTRY;
 
-        if (exp->exp_connection) {
-                spin_lock(&exp->exp_connection->c_lock);
-                list_del(&exp->exp_chain);
-                spin_unlock(&exp->exp_connection->c_lock);
-        }
+        //spin_lock(&exp->exp_connection->c_lock);
+        list_del(&exp->exp_chain);
+        //spin_unlock(&exp->exp_connection->c_lock);
 
         /* XXXshaver these bits want to be hung off the export, instead of
          * XXXshaver hard-coded here.