From 75119e08862a37c6ebb957b38b39da2bb7857289 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 8 Aug 2004 12:09:23 +0000 Subject: [PATCH] b=4182 - races in lmv_check_connect() and mds_lmv_connect() have been fixed --- lustre/include/linux/obd.h | 1 + lustre/lmv/lmv_obd.c | 6 +++--- lustre/mds/handler.c | 1 + lustre/mds/mds_lmv.c | 7 +++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index f6453d3..0cf285e 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -362,6 +362,7 @@ struct mds_obd { atomic_t mds_real_clients; struct obd_uuid mds_lmv_uuid; struct dentry *mds_fids_dir; + int mds_lmv_connected; struct dentry *mds_unnamed_dir; /* for mdt_obd_create only */ }; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index ad9b28a..2ce8ead 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -254,7 +254,6 @@ int lmv_check_connect(struct obd_device *obd) return 0; } - lmv->connected = 1; cluuid = &lmv->cluuid; exp = lmv->exp; @@ -348,6 +347,7 @@ int lmv_check_connect(struct obd_device *obd) lmv_set_timeouts(obd); class_export_put(exp); + lmv->connected = 1; up(&lmv->init_sem); return 0; @@ -401,7 +401,7 @@ static int lmv_disconnect(struct obd_export *exp, int flags) if (mdc_symlink) { lprocfs_remove(mdc_symlink); } else { - CERROR("/proc/fs/lustre/%s/%s/target_obds/%s missing.", + CERROR("/proc/fs/lustre/%s/%s/target_obds/%s missing\n", obd->obd_type->typ_name, obd->obd_name, mdc_obd->obd_name); } @@ -442,7 +442,7 @@ static int lmv_disconnect(struct obd_export *exp, int flags) if (lmv_proc_dir) { lprocfs_remove(lmv_proc_dir); } else { - CERROR("/proc/fs/lustre/%s/%s/target_obds missing.", + CERROR("/proc/fs/lustre/%s/%s/target_obds missing\n", obd->obd_type->typ_name, obd->obd_name); } diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 5182b53..cd5121b 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -2003,6 +2003,7 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) /* we have to know mdsnum before touching underlying fs -bzzz */ sema_init(&mds->mds_lmv_sem, 1); + mds->mds_lmv_connected = 0; if (lcfg->lcfg_inllen5 > 0 && lcfg->lcfg_inlbuf5 && strcmp(lcfg->lcfg_inlbuf5, "dumb")) { class_uuid_t uuid; diff --git a/lustre/mds/mds_lmv.c b/lustre/mds/mds_lmv.c index 8d5a431..30ae15b 100644 --- a/lustre/mds/mds_lmv.c +++ b/lustre/mds/mds_lmv.c @@ -54,11 +54,11 @@ int mds_lmv_connect(struct obd_device *obd, char * lmv_name) if (IS_ERR(mds->mds_lmv_obd)) RETURN(PTR_ERR(mds->mds_lmv_obd)); - if (mds->mds_lmv_obd) + if (mds->mds_lmv_connected) RETURN(0); down(&mds->mds_lmv_sem); - if (mds->mds_lmv_obd) { + if (mds->mds_lmv_connected) { up(&mds->mds_lmv_sem); RETURN(0); } @@ -111,6 +111,7 @@ int mds_lmv_connect(struct obd_device *obd, char * lmv_name) if (rc) GOTO(err_reg, rc); + mds->mds_lmv_connected = 1; up(&mds->mds_lmv_sem); RETURN(0); @@ -146,6 +147,8 @@ int mds_lmv_disconnect(struct obd_device *obd, int flags) down(&mds->mds_lmv_sem); if (!IS_ERR(mds->mds_lmv_obd) && mds->mds_lmv_exp != NULL) { + LASSERT(mds->mds_lmv_connected != 0); + mds->mds_lmv_connected = 0; obd_register_observer(mds->mds_lmv_obd, NULL); /* if obd_disconnect fails (probably because the export was -- 1.8.3.1