From 9b5f4e4d198dcede9d2d16552c8982deb42dfa32 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 30 Aug 2002 05:16:03 +0000 Subject: [PATCH] Mike's fix for the missing exp_connection oops caused us to not remove 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 | 9 +++++---- lustre/obdclass/genops.c | 10 ++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index e396cb6..98af2b0 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -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); } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 0a67f38..00af192 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -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. -- 1.8.3.1