Whamcloud - gitweb
b=4182
authoralex <alex>
Sun, 8 Aug 2004 12:09:23 +0000 (12:09 +0000)
committeralex <alex>
Sun, 8 Aug 2004 12:09:23 +0000 (12:09 +0000)
- races in lmv_check_connect() and mds_lmv_connect() have been fixed

lustre/include/linux/obd.h
lustre/lmv/lmv_obd.c
lustre/mds/handler.c
lustre/mds/mds_lmv.c

index f6453d3..0cf285e 100644 (file)
@@ -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 */
 };
 
index ad9b28a..2ce8ead 100644 (file)
@@ -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);
         }
 
index 5182b53..cd5121b 100644 (file)
@@ -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;
index 8d5a431..30ae15b 100644 (file)
@@ -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