#include <linux/miscdevice.h>
#include <linux/smp_lock.h>
#else
-
# include <liblustre.h>
-
#endif
#include <linux/obd_support.h>
#include <linux/lprocfs_status.h>
#include <portals/lib-types.h> /* for PTL_MD_MAX_IOV */
#include <linux/lustre_build_version.h>
+#include <portals/list.h>
struct semaphore obd_conf_sem; /* serialize configuration commands */
struct obd_device obd_dev[MAX_OBD_DEVICES];
static void dump_exports(struct obd_device *obd)
{
- struct list_head *tmp, *n;
+ struct obd_export *exp, *n;
- list_for_each_safe(tmp, n, &obd->obd_exports) {
- struct obd_export *exp = list_entry(tmp, struct obd_export,
- exp_obd_chain);
- CDEBUG(D_ERROR, "%s: %p %s %d %d %p\n",
+ list_for_each_entry_safe(exp, n, &obd->obd_exports, exp_obd_chain) {
+ CERROR("%s: %p %s %d %d %p\n",
obd->obd_name, exp, exp->exp_client_uuid.uuid,
atomic_read(&exp->exp_refcount),
exp->exp_failed, exp->exp_outstanding_reply );
obd->obd_type->typ_refcnt--;
class_put_type(obd->obd_type);
obd->obd_type = NULL;
+ memset(obd, 0, sizeof(*obd));
GOTO(out, err = 0);
}
atomic_set(&obd->obd_refcount, 0);
- if ( OBT(obd) && OBP(obd, setup) )
+ if (OBT(obd) && OBP(obd, setup))
err = obd_setup(obd, sizeof(*data), data);
if (!err) {
GOTO(out, err);
}
case OBD_IOC_CLEANUP: {
- int force = 0, failover = 0;
- char * flag;
+ int flags = 0;
+ char *flag;
if (!obd->obd_set_up) {
CERROR("Device %d not setup\n", obd->obd_minor);
for (flag = data->ioc_inlbuf1; *flag != 0; flag++)
switch (*flag) {
case 'F':
- force = 1;
+ flags |= OBD_OPT_FORCE;
break;
case 'A':
- failover = 1;
+ flags |= OBD_OPT_FAILOVER;
break;
default:
- CERROR("unrecognised flag '%c'\n",
+ CERROR("unrecognised flag '%c'\n",
*flag);
}
}
-
- if (atomic_read(&obd->obd_refcount) == 1 || force) {
+
+ if (atomic_read(&obd->obd_refcount) == 1 ||
+ flags & OBD_OPT_FORCE) {
/* this will stop new connections, and need to
do it before class_disconnect_exports() */
obd->obd_stopping = 1;
struct l_wait_info lwi = LWI_TIMEOUT_INTR(60 * HZ, NULL,
NULL, NULL);
int rc;
-
- if (!force) {
+
+ if (!(flags & OBD_OPT_FORCE)) {
CERROR("OBD device %d (%p) has refcount %d\n",
- obd->obd_minor, obd,
+ obd->obd_minor, obd,
atomic_read(&obd->obd_refcount));
dump_exports(obd);
GOTO(out, err = -EBUSY);
}
- class_disconnect_exports(obd, failover);
- CDEBUG(D_IOCTL,
- "%s: waiting for obd refs to go away: %d\n",
+ class_disconnect_exports(obd, flags);
+ CDEBUG(D_IOCTL,
+ "%s: waiting for obd refs to go away: %d\n",
obd->obd_name, atomic_read(&obd->obd_refcount));
-
+
rc = l_wait_event(obd->obd_refcount_waitq,
atomic_read(&obd->obd_refcount) < 2, &lwi);
if (rc == 0) {
atomic_read(&obd->obd_refcount));
dump_exports(obd);
}
- CDEBUG(D_IOCTL, "%s: awake, now finishing cleanup\n",
+ CDEBUG(D_IOCTL, "%s: awake, now finishing cleanup\n",
obd->obd_name);
}
if (OBT(obd) && OBP(obd, cleanup))
- err = obd_cleanup(obd, force, failover);
+ err = obd_cleanup(obd, flags);
if (!err) {
obd->obd_set_up = obd->obd_stopping = 0;
EXPORT_SYMBOL(class_conn2ldlmimp);
EXPORT_SYMBOL(class_disconnect);
EXPORT_SYMBOL(class_disconnect_exports);
-EXPORT_SYMBOL(lustre_uuid_to_peer);
/* uuid.c */
EXPORT_SYMBOL(class_uuid_unparse);
+EXPORT_SYMBOL(lustre_uuid_to_peer);
EXPORT_SYMBOL(client_tgtuuid2obd);
EXPORT_SYMBOL(class_handle_hash);
", info@clusterfs.com\n");
class_init_uuidlist();
- class_handle_init();
+ err = class_handle_init();
+ if (err)
+ return err;
sema_init(&obd_conf_sem, 1);
INIT_LIST_HEAD(&obd_types);
- if ((err = misc_register(&obd_psdev))) {
+ err = misc_register(&obd_psdev);
+ if (err) {
CERROR("cannot register %d err %d\n", OBD_MINOR, err);
return err;
}
#endif
#ifdef __KERNEL__
-static void __exit cleanup_obdclass(void)
+static void /*__exit*/ cleanup_obdclass(void)
#else
static void cleanup_obdclass(void)
#endif
* kernel patch */
#ifdef __KERNEL__
#include <linux/lustre_version.h>
-#define LUSTRE_MIN_VERSION 18
-#define LUSTRE_MAX_VERSION 19
+#define LUSTRE_MIN_VERSION 21
+#define LUSTRE_MAX_VERSION 21
#if (LUSTRE_KERNEL_VERSION < LUSTRE_MIN_VERSION)
# error Cannot continue: Your Lustre kernel patch is older than the sources
#elif (LUSTRE_KERNEL_VERSION > LUSTRE_MAX_VERSION)