Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Wed, 7 Dec 2005 01:13:56 +0000 (01:13 +0000)
committernathan <nathan>
Wed, 7 Dec 2005 01:13:56 +0000 (01:13 +0000)
b=8007
TARGET_ADD rpc, log creation

lustre/include/linux/lustre_log.h
lustre/include/linux/lvfs.h
lustre/include/linux/obd.h
lustre/mgc/mgc_request.c
lustre/mgs/mgs_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/llog.c
lustre/obdclass/llog_lvfs.c
lustre/obdclass/obd_mount.c

index 42061d5..68dd7f2 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/obd.h>
 #include <linux/lustre_idl.h>
 
-#define LOG_NAME_MAX 256 /* 2.4 limit */
 #define LOG_NAME_LIMIT(logname, name)                   \
         snprintf(logname, sizeof(logname), "LOGS/%s", name)
 #define LLOG_EEMPTY 4711
@@ -58,11 +57,9 @@ struct cat_handle_data {
 /* In-memory descriptor for a log object or log catalog */
 struct llog_handle {
         struct rw_semaphore     lgh_lock;
-        struct llog_logid       lgh_id;             /* id of this log */
+        struct llog_logid       lgh_id;              /* id of this log */
         struct llog_log_hdr    *lgh_hdr;
-        struct mgc_open_llog   *lgh_mol;
         struct file            *lgh_file;
-        char                   *lgh_fsname;
         int                     lgh_last_idx;
         struct llog_ctxt       *lgh_ctxt;
         union {
@@ -183,23 +180,11 @@ struct llog_operations {
         int (*lop_connect)(struct llog_ctxt *ctxt, int count,
                            struct llog_logid *logid, struct llog_gen *gen,
                            struct obd_uuid *uuid);
-        int (*lop_update)(struct llog_ctxt *ctxt, struct llog_handle **,
-                           struct llog_logid *logid, void *data);
+        /* XXX add 2 more: commit callbacks and llog recovery functions */
 };
 
 /* llog_lvfs.c */
 extern struct llog_operations llog_lvfs_ops;
-int llog_lvfs_write_rec(struct llog_handle *loghandle,
-                        struct llog_rec_hdr *rec,
-                        struct llog_cookie *reccookie, int cookiecount,
-                        void *buf, int idx);
-int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
-                         int next_idx, __u64 *cur_offset, void *buf,
-                         int len);
-int llog_lvfs_close(struct llog_handle *loghandle);
-int llog_lvfs_destroy(struct llog_handle *loghandle);
-extern struct llog_operations mgs_llog_lvfs_ops;
-
 int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
                       char *name, int count, struct llog_catid *idarray);
 
@@ -238,7 +223,7 @@ static inline int llog_gen_lt(struct llog_gen a, struct llog_gen b)
         return(a.conn_cnt < b.conn_cnt ? 1 : 0);
 }
 
-#define LLOG_GEN_INC(gen)  ((gen).conn_cnt) ++
+#define LLOG_GEN_INC(gen)  ((gen).conn_cnt ++)
 #define LLOG_PROC_BREAK 0x0001
 
 static inline int llog_obd2ops(struct llog_ctxt *ctxt,
index ac90e02..858e3f5 100644 (file)
@@ -54,7 +54,6 @@ struct lvfs_ucred {
 
 struct lvfs_callback_ops {
         struct dentry *(*l_fid2dentry)(__u64 id_ino, __u32 gen, __u64 gr, void *data);
-        int (*l_open_llog) (__u64 id_ino, struct dentry *dentry, void *data);
 };
 
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
@@ -87,15 +86,13 @@ struct dentry *lvfs_fid2dentry(struct lvfs_run_ctxt *, __u64, __u32, __u64 ,void
 
 void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx,
                struct lvfs_ucred *cred);
-void pop_ctxt(struct lvfs_run_ctxt *saveu, struct lvfs_run_ctxt *new_ctx,
+void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx,
               struct lvfs_ucred *cred);
 
 #ifdef __KERNEL__
-struct obd_device;
 
 struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode, int fix);
 struct dentry *simple_mknod(struct dentry *dir, char *name, int mode, int fix);
-
 int lustre_fread(struct file *file, void *buf, int len, loff_t *off);
 int lustre_fwrite(struct file *file, const void *buf, int len, loff_t *off);
 int lustre_fsync(struct file *file);
@@ -137,55 +134,6 @@ static inline struct dentry *ll_lookup_one_len(const char *fid_name,
         return dchild;
 }
 
-/* Look up an entry by inode number. */
-/* this function ONLY returns valid dget'd dentries with an initialized inode
-   or errors */
-static inline struct dentry * ll_fid2dentry(struct dentry *parent,
-                                            __u64 ino, __u32 generation)
-{
-        char fid_name[32];
-        struct inode *inode;
-        struct dentry *result;
-
-        if (ino == 0)
-                RETURN(ERR_PTR(-ESTALE));
-
-        snprintf(fid_name, sizeof(fid_name), "0x%lx", (unsigned long)ino);
-
-        /* under ext3 this is neither supposed to return bad inodes
-           nor NULL inodes. */
-        result = ll_lookup_one_len(fid_name, parent, strlen(fid_name));
-        if (IS_ERR(result))
-                RETURN(result);
-
-        inode = result->d_inode;
-        if (!inode)
-                RETURN(ERR_PTR(-ENOENT));
-
-        if (inode->i_generation == 0 || inode->i_nlink == 0) {
-                LCONSOLE_WARN("Found inode with zero generation or link -- this"
-                              " may indicate disk corruption (inode: %lu, link:"
-                              " %lu, count: %d)\n", inode->i_ino,
-                              (unsigned long)inode->i_nlink,
-                              atomic_read(&inode->i_count));
-                dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        if (generation && inode->i_generation != generation) {
-                /* we didn't find the right inode.. */
-                CDEBUG(D_INODE, "found wrong generation: inode %lu, link: %lu, "
-                       "count: %d, generation %u/%u\n", inode->i_ino,
-                       (unsigned long)inode->i_nlink,
-                       atomic_read(&inode->i_count), inode->i_generation,
-                       generation);
-                dput(result);
-                RETURN(ERR_PTR(-ENOENT));
-        }
-
-        RETURN(result);
-}
-
 static inline void ll_sleep(int t)
 {
         set_current_state(TASK_INTERRUPTIBLE);
index 4232d58..7feb429 100644 (file)
@@ -458,7 +458,6 @@ struct niobuf_local {
 #define LUSTRE_SANOSC_NAME "sanosc"
 #define LUSTRE_SANOST_NAME "sanost"
 #define LUSTRE_MGS_NAME "mgs"
-#define LUSTRE_MGT_NAME "mgt"
 #define LUSTRE_MGC_NAME "mgc"
 
 
index 261889a..33ca7f0 100644 (file)
@@ -220,6 +220,8 @@ static int mgc_cleanup(struct obd_device *obd)
 
         //lprocfs_obd_cleanup(obd);
 
+        /* FIXME calls to mgc_fs_setup must take an obd ref to insure there's
+           no fs by the time we get here. */
         LASSERT(cli->cl_mgc_vfsmnt == NULL);
 
         rc = obd_llog_finish(obd, 0);
index 6a88785..b48d2d0 100644 (file)
@@ -305,6 +305,7 @@ out:
         /* send back the whole mti in the reply */
         rep_mti = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*rep_mti));
         memcpy(rep_mti, mti, sizeof(*rep_mti));
+        // FIXME rc is redundant, part of the req (target_send_reply)
         rep_mti->mti_rc = rc;
         RETURN(rc);
 }
index e16680d..86a6fd2 100644 (file)
@@ -54,6 +54,8 @@ static int db_handler(struct llog_handle *llh, struct llog_rec_hdr *rec,
         int rc = 0;
         ENTRY;
 
+        CDEBUG(D_MGS, "db_handler\n");
+
         db->sdb_flags &= ~SDB_NO_LLOG;
 
         if (rec->lrh_type == OBD_CFG_REC) {
@@ -98,12 +100,12 @@ static int get_db_from_llog(struct obd_device *obd, char *logname,
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        rc = llog_create(llog_get_context(obd, LLOG_CONFIG_REPL_CTXT),
+        rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT),
                          &loghandle, NULL, logname);
         if (rc)
                 GOTO(out_pop, rc);
 
-        llog_init_handle(loghandle, 0, NULL);
+        llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL);
         if (rc)
                 GOTO(out_close, rc);
 
@@ -270,6 +272,10 @@ int mgs_set_next_index(struct obd_device *obd, struct mgmt_target_info *mti)
         int rc = 0;
 
         rc = mgs_find_or_make_db(obd, mti->mti_fsname, &db); 
+        if (rc) {
+                CERROR("Can't get db for %s\n", mti->mti_fsname);
+                return rc;
+        }
 
         if (mti->mti_flags & LDD_F_SV_TYPE_OST)
                 mti->mti_stripe_index = 
@@ -343,17 +349,29 @@ out:
         return rc;
 }
 
-static inline int mgs_do_record(struct obd_device *obd, struct llog_handle *llh,
-                                struct lustre_cfg *lcfg)
+static int mgs_do_record(struct obd_device *obd, struct llog_handle *llh,
+                         struct lustre_cfg *lcfg)
 {
         struct lvfs_run_ctxt   saved;
         struct llog_rec_hdr    rec;
-        int rc;
+        int buflen, rc;
+
+        LASSERT(llh);
+        LASSERT(llh->lgh_ctxt);        
+
+        buflen = lustre_cfg_len(lcfg->lcfg_bufcount,
+                                lcfg->lcfg_buflens);
+        rec.lrh_len = llog_data_len(buflen);
+        rec.lrh_type = OBD_CFG_REC;
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         /* idx = -1 means append */
         rc = llog_write_rec(llh, &rec, NULL, 0, (void *)lcfg, -1);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+        if (rc) {
+                CERROR("failed %d\n", rc);
+        }
+        LASSERT(!rc);
         return rc;
 }
 
@@ -365,7 +383,7 @@ static int record_base(struct obd_device *obd, struct llog_handle *llh,
         struct lustre_cfg     *lcfg;
         int rc;
                
-        CDEBUG(D_TRACE|D_WARNING, "lcfg %s %#x %s %s %s %s\n", cfgname,
+        CDEBUG(D_MGS, "lcfg %s %#x %s %s %s %s\n", cfgname,
                cmd, s1, s2, s3, s4); 
 
         lustre_cfg_bufs_reset(&bufs, cfgname);
@@ -386,7 +404,7 @@ static int record_base(struct obd_device *obd, struct llog_handle *llh,
         lustre_cfg_free(lcfg);
         
         if (rc) {
-                CERROR("lcfg %s %#x %s %s %s %s\n", cfgname,
+                CERROR("error %d: lcfg %s %#x %s %s %s %s\n", rc, cfgname,
                        cmd, s1, s2, s3, s4); 
         }
         return(rc);
@@ -420,6 +438,8 @@ static int record_lov_setup(struct obd_device *obd, struct llog_handle *llh,
         struct lustre_cfg *lcfg;
         int rc;
 
+        CDEBUG(D_MGS, "lcfg %s lov_setup\n", device_name);
+
         lustre_cfg_bufs_reset(&bufs, device_name);
         lustre_cfg_bufs_set(&bufs, 1, desc, sizeof(*desc));
         lcfg = lustre_cfg_new(LCFG_SETUP, &bufs);
@@ -435,13 +455,17 @@ static inline int record_lov_add(struct obd_device *obd,
                                  char *lov_name, char *ost_uuid,
                                  char *index, char *gen)
 {
-        return record_base(obd,llh,lov_name,0,LCFG_LOV_ADD_OBD,ost_uuid,index,gen,0);
+        return record_base(obd,llh,lov_name,0,LCFG_LOV_ADD_OBD,
+                           ost_uuid,index,gen,0);
 }                                  
 
-static inline int record_mount_opt(struct obd_device *obd, struct llog_handle *llh,
-                                     char *profile, char *lov_name, char *mdc_name)
+static inline int record_mount_opt(struct obd_device *obd, 
+                                   struct llog_handle *llh,
+                                   char *profile, char *lov_name,
+                                   char *mdc_name)
 {
-        return record_base(obd,llh,NULL,0,LCFG_MOUNTOPT,profile,lov_name,mdc_name,0);
+        return record_base(obd,llh,NULL,0,LCFG_MOUNTOPT,
+                           profile,lov_name,mdc_name,0);
 }                                  
 
 static int record_start_log(struct obd_device *obd, 
@@ -451,8 +475,9 @@ static int record_start_log(struct obd_device *obd,
         struct lvfs_run_ctxt saved;
         int rc = 0;
         
-        if (*llh)
-                RETURN(-EBUSY);
+        if (*llh) {
+                GOTO(out, rc = -EBUSY);
+        }
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
@@ -465,21 +490,22 @@ static int record_start_log(struct obd_device *obd,
 
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
+out:
         if (rc) {
                 CERROR("Can't start log %s: %d\n", name, rc);
         }
         RETURN(rc);
 }
 
-static int record_end_log(struct obd_device *obd, struct llog_handle *llh)
+static int record_end_log(struct obd_device *obd, struct llog_handle **llh)
 {
         struct lvfs_run_ctxt saved;
         int rc = 0;
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-        rc = llog_close(llh);
+        rc = llog_close(*llh);
         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
+        *llh = NULL;
         RETURN(rc);
 }
 
@@ -509,7 +535,7 @@ static int mgs_clear_log(struct obd_device *obd, char *name)
 static int mgs_write_log_lov(struct obd_device *obd, char *fsname,
                              char *logname, char *lovname)
 {
-        struct llog_handle *llh;
+        struct llog_handle *llh = NULL;
         struct lov_desc *lovdesc;
         char *uuid;
         int rc = 0;
@@ -518,7 +544,7 @@ static int mgs_write_log_lov(struct obd_device *obd, char *fsname,
         /*
         #01 L attach   0:lov_mdsA  1:lov  2:71ccb_lov_mdsA_19f961a9e1
         #02 L lov_setup 0:lov_mdsA 1:(struct lov_desc)
-               uuid=lov1_UUID, stripe count=1, size=1048576, offset=0, pattern=0
+              uuid=lov1_UUID, stripe count=1, size=1048576, offset=0, pattern=0
         */
 
         /* FIXME just make lov_setup accept empty desc (put uuid in buf 2) */
@@ -536,7 +562,6 @@ static int mgs_write_log_lov(struct obd_device *obd, char *fsname,
         rc = record_start_log(obd, &llh, logname);
         rc = record_attach(obd, llh, lovname, "lov", uuid);
         rc = record_lov_setup(obd, llh, lovname, lovdesc);
-        rc = record_end_log(obd, llh);
         
         RETURN(rc);
 }
@@ -545,7 +570,7 @@ static int mgs_write_log_mdt(struct obd_device *obd,
                              struct mgmt_target_info *mti)
 {
         struct system_db *db;
-        struct llog_handle *llh;
+        struct llog_handle *llh = NULL;
         char *cliname, *mdcname, *lovname, *nodeuuid, *mdsuuid, *mdcuuid;
         int rc, first_log = 0;
 
@@ -555,6 +580,8 @@ static int mgs_write_log_mdt(struct obd_device *obd,
                 return(-EINVAL);
         }
 
+        CDEBUG(D_MGS, "writing new mdt %s\n", mti->mti_svname);
+
         name_create(mti->mti_fsname, "-mdtlov", &lovname);
         /* Append mdt info to mdt log */
         if (LOG_IS_EMPTY(db)) {
@@ -587,7 +614,7 @@ static int mgs_write_log_mdt(struct obd_device *obd,
         rc = record_setup(obd,llh,mti->mti_svname,
                           "dev"/*ignored*/,"type"/*ignored*/,
                           mti->mti_svname, 0/*options*/);
-        rc = record_end_log(obd, llh);
+        rc = record_end_log(obd, &llh);
 
         /* Append mdt info to the client log */
         name_create(mti->mti_fsname, "-client", &cliname);
@@ -620,7 +647,7 @@ static int mgs_write_log_mdt(struct obd_device *obd,
         rc = record_setup(obd,llh,mdcname,mdsuuid,nodeuuid,0,0);
         /* FIXME add uuid, add_conn for failover mdt's */
         rc = record_mount_opt(obd, llh, cliname, lovname, mdcname);
-        rc = record_end_log(obd, llh);
+        rc = record_end_log(obd, &llh);
 
         name_destroy(mdcuuid);
         name_destroy(mdcname);
@@ -637,7 +664,7 @@ static int mgs_write_log_osc(struct obd_device *obd,
                              int first_log,
                              char *logname, char *lovname, char *ostuuid)
 {
-        struct llog_handle *llh;
+        struct llog_handle *llh = NULL;
         char *nodeuuid, *oscname, *oscuuid;
         char index[5];
         int rc;
@@ -654,7 +681,7 @@ static int mgs_write_log_osc(struct obd_device *obd,
 
         /*
         #03 L add_uuid nid=uml1@tcp(0x20000c0a80201) 0:  1:uml1_UUID
-        #04 L attach   0:OSC_uml1_ost1_MNT_client  1:osc  2:89070_lov1_a41dff511a
+        #04 L attach   0:OSC_uml1_ost1_MNT_client  1:osc  2:89070_lov1_a41dff51a
         #05 L setup    0:OSC_uml1_ost1_MNT_client  1:ost1_UUID  2:uml1_UUID
         #06 L add_uuid nid=uml2@tcp(0x20000c0a80202) 0:  1:uml2_UUID
         #07 L add_conn 0:OSC_uml1_ost1_MNT_client  1:uml2_UUID
@@ -666,8 +693,8 @@ static int mgs_write_log_osc(struct obd_device *obd,
         rc = record_setup(obd, llh, oscname, ostuuid, nodeuuid, 0, 0);
         /* FIXME add uuid, add_conn for failover ost's */
         snprintf(index, sizeof(index), "%d", mti->mti_stripe_index);
-        rc = record_lov_add(obd, llh, lovname, ostuuid, index, "1"/*generation*/);
-        rc = record_end_log(obd, llh);
+        rc = record_lov_add(obd,llh, lovname, ostuuid, index,"1"/*generation*/);
+        rc = record_end_log(obd, &llh);
         
         name_destroy(oscuuid);
         name_destroy(oscname);
@@ -679,7 +706,7 @@ static int mgs_write_log_ost(struct obd_device *obd,
                              struct mgmt_target_info *mti)
 {
         struct system_db *db;
-        struct llog_handle *llh;
+        struct llog_handle *llh = NULL;
         char *logname, *lovname, *ostuuid;
         int rc, first_log = 0;
 
@@ -692,6 +719,8 @@ static int mgs_write_log_ost(struct obd_device *obd,
                 /* First time for all logs for this fs */
                 first_log++;
         
+        CDEBUG(D_MGS, "writing new ost %s\n", mti->mti_svname);
+
         /* The ost startup log */
         /*
         attach obdfilter ost1 ost1_UUID
@@ -699,11 +728,12 @@ static int mgs_write_log_ost(struct obd_device *obd,
         */
         rc = record_start_log(obd, &llh, mti->mti_svname);
         name_create(mti->mti_svname, "_UUID", &ostuuid);
-        rc = record_attach(obd, llh, mti->mti_svname, "obdfilter"/*LUSTRE_OST_NAME*/, ostuuid);
+        rc = record_attach(obd, llh, mti->mti_svname,
+                           "obdfilter"/*LUSTRE_OST_NAME*/, ostuuid);
         rc = record_setup(obd,llh,mti->mti_svname,
                           "dev"/*ignored*/,"type"/*ignored*/,
                           "f", 0/*options*/);
-        rc = record_end_log(obd, llh);
+        rc = record_end_log(obd, &llh);
         
         /* We also have to update the other logs where this osc is part of 
            the lov */
index 17f7a45..85cec7b 100644 (file)
@@ -142,6 +142,7 @@ int llog_init_handle(struct llog_handle *handle, int flags,
         /* first assign flags to use llog_client_ops */
         llh->llh_flags = flags;
         rc = llog_read_header(handle);
+        CDEBUG(D_ERROR, "read header rc=%d fl=%d\n", rc, flags);
         if (rc == 0) {
                 flags = llh->llh_flags;
                 if (uuid)
@@ -214,6 +215,8 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
         int saved_index = 0;
         ENTRY;
 
+        LASSERT(llh);
+
         OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
         if (!buf)
                 RETURN(-ENOMEM);
index 5fdc908..efde997 100644 (file)
@@ -84,7 +84,7 @@ static int llog_lvfs_pad(struct obd_device *obd, struct l_file *file,
         RETURN(rc);
 }
 
-int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file,
+static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file,
                                 struct llog_rec_hdr *rec, void *buf, loff_t off)
 {
         int rc;
@@ -149,7 +149,7 @@ static int llog_lvfs_read_blob(struct obd_device *obd, struct l_file *file,
         RETURN(0);
 }
 
-int llog_lvfs_read_header(struct llog_handle *handle)
+static int llog_lvfs_read_header(struct llog_handle *handle)
 {
         struct obd_device *obd;
         int rc;
@@ -201,7 +201,7 @@ int llog_lvfs_read_header(struct llog_handle *handle)
 
 /* returns negative in on error; 0 if success && reccookie == 0; 1 otherwise */
 /* appends if idx == -1, otherwise overwrites record idx. */
-int llog_lvfs_write_rec(struct llog_handle *loghandle,
+static int llog_lvfs_write_rec(struct llog_handle *loghandle,
                                struct llog_rec_hdr *rec,
                                struct llog_cookie *reccookie, int cookiecount,
                                void *buf, int idx)
@@ -345,7 +345,7 @@ static void llog_skip_over(__u64 *off, int curr, int goal)
  *  - cur_idx to the log index preceeding cur_offset
  * returns -EIO/-EINVAL on error
  */
-int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
+static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
                                 int next_idx, __u64 *cur_offset, void *buf,
                                 int len)
 {
@@ -433,15 +433,13 @@ static struct file *llog_filp_open(char *name, int flags, int mode)
 
         OBD_ALLOC(logname, PATH_MAX);
         if (logname == NULL)
-                return ERR_PTR(-ENOMEM); 
+                return ERR_PTR(-ENOMEM);
 
         len = snprintf(logname, PATH_MAX, "%s/%s", 
                        MOUNT_CONFIGS_DIR, name);
-
         if (len >= PATH_MAX - 1) {
                 filp = ERR_PTR(-ENAMETOOLONG);
         } else {
-                CERROR("logname = %s\n", logname);
                 filp = l_filp_open(logname, flags, mode);
                 if (IS_ERR(filp))
                         CERROR("logfile creation %s: %ld\n", logname,
@@ -454,7 +452,7 @@ static struct file *llog_filp_open(char *name, int flags, int mode)
 
 /* This is a callback from the llog_* functions.
  * Assumes caller has already pushed us into the kernel context. */
-int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
+static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
                             struct llog_logid *logid, char *name)
 {
         struct llog_handle *handle;
@@ -507,7 +505,6 @@ int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
 
         } else if (name) {
                 handle->lgh_file = llog_filp_open(name, open_flags, 0644);
-
                 if (IS_ERR(handle->lgh_file))
                         GOTO(cleanup, rc = PTR_ERR(handle->lgh_file));
 
@@ -516,7 +513,6 @@ int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
                         handle->lgh_file->f_dentry->d_inode->i_ino;
                 handle->lgh_id.lgl_ogen =
                         handle->lgh_file->f_dentry->d_inode->i_generation;
-                
         } else {
                 oa = obdo_alloc();
                 if (oa == NULL)
@@ -559,7 +555,7 @@ cleanup:
         goto finish;
 }
 
-int llog_lvfs_close(struct llog_handle *handle)
+static int llog_lvfs_close(struct llog_handle *handle)
 {
         int rc;
         ENTRY;
@@ -570,7 +566,7 @@ int llog_lvfs_close(struct llog_handle *handle)
         RETURN(rc);
 }
 
-int llog_lvfs_destroy(struct llog_handle *handle)
+static int llog_lvfs_destroy(struct llog_handle *handle)
 {
         struct dentry *fdentry;
         struct obdo *oa;
@@ -579,7 +575,6 @@ int llog_lvfs_destroy(struct llog_handle *handle)
 
         fdentry = handle->lgh_file->f_dentry;
         if (strcmp(fdentry->d_parent->d_name.name, MOUNT_CONFIGS_DIR) == 0) {
-                /* CONFIGS files aren't really "lustre" objects - special case*/
                 struct obd_device *obd = handle->lgh_ctxt->loc_exp->exp_obd;
                 struct inode *inode = fdentry->d_parent->d_inode;
                 struct lvfs_run_ctxt saved;
@@ -628,10 +623,7 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
         int size = sizeof(*idarray) * count;
         loff_t off = 0;
 
-        if (!count) {
-                CERROR("Empty catalog?\n");
-                RETURN(0);
-        }
+        LASSERT(count);
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
@@ -673,11 +665,8 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
         int size = sizeof(*idarray) * count;
         loff_t off = 0;
 
-        if (!count) {
-                CERROR("Empty catalog?\n");
-                RETURN(0);
-        }
-        
+        LASSERT(count);
+
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
         if (!file || IS_ERR(file)) {
@@ -717,12 +706,6 @@ struct llog_operations llog_lvfs_ops = {
         //        lop_cancel: llog_lvfs_cancel,
 };
 
-EXPORT_SYMBOL(llog_lvfs_write_rec);
-EXPORT_SYMBOL(llog_lvfs_next_block);
-EXPORT_SYMBOL(llog_lvfs_read_header);
-EXPORT_SYMBOL(llog_lvfs_create);
-EXPORT_SYMBOL(llog_lvfs_destroy);
-EXPORT_SYMBOL(llog_lvfs_close);
 EXPORT_SYMBOL(llog_lvfs_ops);
 
 #else /* !__KERNEL__ */
@@ -751,7 +734,7 @@ static int llog_lvfs_next_block(struct llog_handle *loghandle, int *cur_idx,
 }
 
 static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res,
-                            struct llog_logid *logid, char *fsname, char *name)
+                            struct llog_logid *logid, char *name)
 {
         LBUG();
         return 0;
index dc0fdca..a224a6d 100644 (file)
@@ -708,7 +708,7 @@ static void server_stop_servers(struct super_block *sb)
 }
 
 /* Add this target to the fs, get a new index if needed */
-static int server_initial_connect(struct super_block *sb, struct vfsmount *mnt)
+static int server_add_target(struct super_block *sb, struct vfsmount *mnt)
 {       
         struct lustre_sb_info *lsi = s2lsi(sb);
         struct obd_device *mgc = lsi->lsi_mgc;
@@ -733,7 +733,8 @@ static int server_initial_connect(struct super_block *sb, struct vfsmount *mnt)
                 sizeof(mti->mti_svname));
         // char             mti_nodename[NAME_MAXLEN];
         // char             mti_uuid[UUID_MAXLEN];
-        rc = LNetGetId(1, &id);
+        /* FIXME nid 0 is lo generally, need to send all non-lo nids */
+        rc = LNetGetId(1, &id);  
         mti->mti_nid = id.nid;
         mti->mti_config_ver = 0;
         mti->mti_flags = ldd->ldd_flags;
@@ -742,7 +743,7 @@ static int server_initial_connect(struct super_block *sb, struct vfsmount *mnt)
         mti->mti_stripe_size = 1024*1024;  //FIXME    
         mti->mti_stripe_offset = 0; //FIXME    
 
-        CDEBUG(D_MOUNT, "Initial connect %s, fs=%s, %s, index=%d\n",
+        CDEBUG(D_MOUNT, "Initial connect %s, fs=%s, %s, index=%04x\n",
                mti->mti_svname, mti->mti_fsname,
                libcfs_nid2str(mti->mti_nid), mti->mti_stripe_index);
 
@@ -767,6 +768,7 @@ static int server_initial_connect(struct super_block *sb, struct vfsmount *mnt)
         rc = obd_set_info(exp,
                           strlen("add_target"), "add_target",
                           sizeof(*mti), mti);
+        CDEBUG(D_MOUNT, "disconnect");
         obd_disconnect(exp);
         if (rc) {
                 CERROR("add_target failed %d\n", rc);
@@ -837,7 +839,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
         /* Get a new index if needed */
         if (lsi->lsi_ldd->ldd_flags & (LDD_F_NEED_INDEX | LDD_F_NEED_REGISTER)) {
                 CDEBUG(D_MOUNT, "Need new target index from MGS\n");
-                rc = server_initial_connect(sb, mnt);
+                rc = server_add_target(sb, mnt);
                 if (rc) {
                         CERROR("Initial connect failed for %s: %d\n", 
                                lsi->lsi_ldd->ldd_svname, rc);
@@ -1020,7 +1022,8 @@ out_free:
 static void server_put_super(struct super_block *sb)
 {
         struct lustre_sb_info *lsi = s2lsi(sb);
-        struct obd_device *obd;
+        struct obd_device     *obd;
+        struct vfsmount       *mnt = lsi->lsi_srv_mnt;
                                                                                        
         CDEBUG(D_MOUNT, "server put_super %s\n", lsi->lsi_ldd->ldd_svname);
                                                                                        
@@ -1036,8 +1039,6 @@ static void server_put_super(struct super_block *sb)
                 CERROR("no obd %s\n", lsi->lsi_ldd->ldd_svname);
         }
 
-        //class_del_profile(lsi->lsi_ldd->ldd_svname); /* if it exists */
-                                                                                       
        server_stop_servers(sb);
 
         /* If they wanted the mgs to stop separately from the mdt, they
@@ -1048,8 +1049,8 @@ static void server_put_super(struct super_block *sb)
         /* clean the mgc and sb */
         lustre_common_put_super(sb);
         
-        /* drop the kernel mount from server_fill_super */
-        unlock_mntput(lsi->lsi_srv_mnt);
+        /* drop the One True Mount */
+        unlock_mntput(mnt);
 }
 
 static void server_umount_begin(struct super_block *sb)