Whamcloud - gitweb
If we are passed a bad connection handle don't oops.
authoradilger <adilger>
Fri, 4 Oct 2002 08:00:09 +0000 (08:00 +0000)
committeradilger <adilger>
Fri, 4 Oct 2002 08:00:09 +0000 (08:00 +0000)
lustre/lib/client.c

index 8233336..93c9e03 100644 (file)
@@ -182,11 +182,19 @@ int client_obd_disconnect(struct lustre_handle *conn)
 {
         struct obd_device *obd = class_conn2obd(conn);
         struct client_obd *cli = &obd->u.cli;
-        int rq_opc = (obd->obd_type->typ_ops->o_brw) ? OST_DISCONNECT : MDS_DISCONNECT;
+        int rq_opc;
         struct ptlrpc_request *request = NULL;
         int rc, err;
         ENTRY;
 
+        if (!obd) {
+                CERROR("invalid connection for disconnect: addr "LPX64
+                       ", cookie "LPX64"\n", conn ? conn->addr : -1UL,
+                       conn ? conn->cookie : -1UL);
+                RETURN(-EINVAL);
+        }
+
+        rq_opc = obd->obd_type->typ_ops->o_brw ? OST_DISCONNECT:MDS_DISCONNECT;
         down(&cli->cl_sem);
         if (!cli->cl_conn_count) {
                 CERROR("disconnecting disconnected device (%s)\n",