From 1b4785682e26e3c9e42aece21fc81cafd97605b6 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 4 Oct 2002 08:00:09 +0000 Subject: [PATCH] If we are passed a bad connection handle don't oops. --- lustre/lib/client.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lustre/lib/client.c b/lustre/lib/client.c index 8233336..93c9e03 100644 --- a/lustre/lib/client.c +++ b/lustre/lib/client.c @@ -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", -- 1.8.3.1