Whamcloud - gitweb
The noncontroversial portion of the last few days of changes:
authorpschwan <pschwan>
Wed, 17 Apr 2002 17:39:07 +0000 (17:39 +0000)
committerpschwan <pschwan>
Wed, 17 Apr 2002 17:39:07 +0000 (17:39 +0000)
- ENTRY/EXIT/RETURN cleanups
- extraneous header file removal
- made forgetting the 'setup' arguments in MDS/OST less fatal
- added the connection and token to the CONNECT RPC, so that we can do the
  pointer/token connection trick now
- fixed the 60 byte/-60 byte "leak"
- added ptlrpc and ldlm setup to llmount.sh, llrmount.sh, -client, and -server

21 files changed:
lustre/include/linux/lustre_ha.h
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_net.h
lustre/include/linux/obd.h
lustre/ldlm/ldlm_extent.c
lustre/ldlm/ldlm_resource.c
lustre/llite/rw.c
lustre/llite/super.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/obdfilter/filter.c
lustre/ost/ost_handler.c
lustre/ptlrpc/client.c
lustre/ptlrpc/recovd.c
lustre/ptlrpc/rpc.c
lustre/ptlrpc/service.c
lustre/tests/llmount-client.sh
lustre/tests/llmount-server.sh
lustre/tests/llmount.sh
lustre/tests/llmountcleanup.sh
lustre/tests/llrmount.sh

index 3913e01..ba61536 100644 (file)
@@ -1,6 +1,12 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */
+
 #ifndef _LUSTRE_HA_H
 #define _LUSTRE_HA_H
 
+#include <linux/lustre_net.h>
+
 #define MGR_STOPPING   1
 #define MGR_RUNNING    2
 #define MGR_STOPPED    4
 
 extern struct connmgr_obd *ptlrpc_connmgr;
 
-struct connmgr_thread { 
+struct connmgr_thread {
         struct connmgr_obd *mgr;
         char *name;
 };
 
+struct connmgr_body {
+        __u64 conn;
+        __u64 conn_token;
 
-struct connmgr_body { 
         __u32 generation;
 };
 
-int connmgr_connect(struct connmgr_obd *mgr, struct ptlrpc_connection *cn);
+int connmgr_connect(struct connmgr_obd *mgr, struct ptlrpc_connection *conn);
+int connmgr_handle(struct obd_device *dev, struct ptlrpc_service *svc,
+                   struct ptlrpc_request *req);
 void connmgr_cli_fail(struct ptlrpc_client *cli);
 void connmgr_cli_manage(struct connmgr_obd *mgr, struct ptlrpc_client *cli);
+int recovd_setup(struct connmgr_obd *mgr);
+int recovd_cleanup(struct connmgr_obd *mgr);
 
 #endif
index cacdc83..bc43dc4 100644 (file)
@@ -1,17 +1,20 @@
-/* object based disk file system
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ * object based disk file system
  * 
  * This code is issued under the GNU General Public License.
  * See the file COPYING in this distribution
  * 
  *
  *
- *
 
 
 
 #ifndef _LL_H
 #define _LL_H
 
+#include <linux/fs.h>
 #include <linux/ext2_fs.h>
 
 #include <linux/lustre_net.h>
@@ -99,4 +102,3 @@ void ll_sysctl_init(void);
 void ll_sysctl_clean(void);
 
 #endif
-
index 4d60329..1dbc2ca 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/obd_class.h>
 #include <portals/p30.h>
 #include <linux/lustre_idl.h>
-#include <linux/lustre_ha.h>
 
 /* FOO_REQUEST_PORTAL is for incoming requests on the FOO
  * FOO_REPLY_PORTAL   is for incoming replies on the FOO
index 0e80c8d..c2e5d4b 100644 (file)
@@ -141,6 +141,7 @@ struct ost_obd {
 struct osc_obd {
         struct obd_device *osc_tgt;
         struct ptlrpc_client *osc_client;
+        struct ptlrpc_client *osc_ldlm_client;
         struct ptlrpc_connection *osc_conn;
 };
 
index ff5c512..e24a457 100644 (file)
  */
 
 #define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <asm/unistd.h>
-
 #define DEBUG_SUBSYSTEM S_LDLM
 
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
 #include <linux/lustre_dlm.h>
 
 /* This function will be called to judge if the granted queue of another child
index 157c89e..dc8e2c6 100644 (file)
  */
 
 #define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <asm/unistd.h>
-
 #define DEBUG_SUBSYSTEM S_LDLM
 
-#include <linux/obd_support.h>
-#include <linux/obd_class.h>
-
+#include <linux/slab.h>
 #include <linux/lustre_dlm.h>
 
-kmem_cache_t *ldlm_resource_slab;
-kmem_cache_t *ldlm_lock_slab;
+kmem_cache_t *ldlm_resource_slab, *ldlm_lock_slab;
 
 struct list_head ldlm_namespaces;
 spinlock_t ldlm_spinlock;
index 091887e..69ccf4c 100644 (file)
@@ -191,8 +191,7 @@ static int ll_readpage(struct file *file, struct page *page)
         if (!PageLocked(page))
                 LBUG();
 
-        if ( ((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT)
-             <= page->index) {
+        if (((inode->i_size + PAGE_CACHE_SIZE -1)>>PAGE_SHIFT) <= page->index) {
                 memset(kmap(page), 0, PAGE_CACHE_SIZE);
                 kunmap(page);
                 GOTO(readpage_out, rc);
index 241ea28..6bc188c 100644 (file)
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/locks.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
 #include <linux/lustre_lite.h>
+#include <linux/lustre_ha.h>
 
 kmem_cache_t *ll_file_data_slab;
 extern struct address_space_operations ll_aops;
@@ -50,26 +36,21 @@ static char *ll_read_opt(const char *opt, char *data)
         ENTRY;
 
         CDEBUG(D_INFO, "option: %s, data %s\n", opt, data);
-        if ( strncmp(opt, data, strlen(opt)) ) {
-                EXIT;
-                return NULL;
-        }
-        if ( (value = strchr(data, '=')) == NULL ) {
-                EXIT;
-                return NULL;
-        }
+        if ( strncmp(opt, data, strlen(opt)) )
+                RETURN(NULL);
+        if ( (value = strchr(data, '=')) == NULL )
+                RETURN(NULL);
 
         value++;
         OBD_ALLOC(retval, strlen(value) + 1);
         if ( !retval ) {
                 CERROR("out of memory!\n");
-                return NULL;
+                RETURN(NULL);
         }
         
         memcpy(retval, value, strlen(value)+1);
         CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
-        EXIT;
-        return retval;
+        RETURN(retval);
 }
 
 static void ll_options(char *options, char **dev, char **vers)
@@ -135,8 +116,7 @@ static struct super_block * ll_read_super(struct super_block *sb,
                 GOTO(out_free, sb = NULL);
         }
 
-        ptlrpc_init_client(ptlrpc_connmgr, 
-                           MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL,
+        ptlrpc_init_client(ptlrpc_connmgr, MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL,
                            &sbi->ll_mds_client);
 
         sbi->ll_mds_conn = ptlrpc_uuid_to_connection("mds");
@@ -290,8 +270,7 @@ int ll_inode_setattr(struct inode *inode, struct iattr *attr, int do_trunc)
 
         ptlrpc_free_req(request);
 
-        EXIT;
-        return err;
+        RETURN(err);
 }
 
 int ll_setattr(struct dentry *de, struct iattr *attr)
@@ -303,19 +282,17 @@ static int ll_statfs(struct super_block *sb, struct statfs *buf)
 {
         struct statfs tmp;
         int err;
-
         ENTRY;
 
         err = obd_statfs(ID(sb), &tmp);
         if ( err ) { 
                 CERROR("obd_statfs fails (%d)\n", err);
-                return err;
+                RETURN(err);
         }
         memcpy(buf, &tmp, sizeof(*buf));
         CDEBUG(D_SUPER, "statfs returns avail %ld\n", tmp.f_bavail);
-        EXIT;
 
-        return err; 
+        RETURN(err);
 }
 
 static void inline ll_to_inode(struct inode *dst, struct mds_body *body)
@@ -393,9 +370,9 @@ static inline void ll_read_inode2(struct inode *inode, void *opaque)
         } else {
                 init_special_inode(inode, inode->i_mode,
                                    ((int *)ll_i2info(inode)->lli_inline)[0]);
+                EXIT;
         }
 
-        EXIT;
         return;
 }
 
index 4ca7ad4..f4e7b50 100644 (file)
@@ -223,7 +223,7 @@ int mdc_readpage(struct ptlrpc_client *cl, struct ptlrpc_connection *conn,
 static int request_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long arg)
 {
-        int err;
+        int err = 0;
         struct ptlrpc_client cl;
         struct ptlrpc_connection *conn;
         struct ptlrpc_request *request;
@@ -262,7 +262,7 @@ static int request_ioctl(struct inode *inode, struct file *file,
                 OBD_ALLOC(buf, PAGE_SIZE);
                 if (!buf) {
                         err = -ENOMEM;
-                        break;
+                        GOTO(out, err);
                 }
                 CERROR("-- readpage 0 for ino %lu\n", arg);
                 err = mdc_readpage(&cl, conn, arg, S_IFDIR, 0, buf, &request);
index 652cf8f..2cb85ff 100644 (file)
@@ -510,6 +510,9 @@ static int mds_setup(struct obd_device *obddev, obd_count len, void *buf)
 #ifdef CONFIG_DEV_RDONLY
         dev_clear_rdonly(2);
 #endif
+        if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2)
+                RETURN(-EINVAL);
+
         mds->mds_fstype = strdup(data->ioc_inlbuf2);
 
         if (!strcmp(mds->mds_fstype, "ext3"))
index 104e4da..cf579fb 100644 (file)
@@ -270,6 +270,9 @@ static int filter_setup(struct obd_device *obddev, obd_count len, void *buf)
         int err = 0;
         ENTRY;
 
+        if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2)
+                RETURN(-EINVAL);
+
         MOD_INC_USE_COUNT;
         mnt = do_kern_mount(data->ioc_inlbuf2, 0, data->ioc_inlbuf1, NULL);
         err = PTR_ERR(mnt);
index 47f2628..1a70c99 100644 (file)
@@ -568,11 +568,8 @@ out:
         return 0;
 }
 
-
 /* mount the file system (secretly) */
-static int ost_setup(struct obd_device *obddev, obd_count len,
-                        void *buf)
-
+static int ost_setup(struct obd_device *obddev, obd_count len, void *buf)
 {
         struct obd_ioctl_data* data = buf;
         struct ost_obd *ost = &obddev->u.ost;
@@ -580,14 +577,14 @@ static int ost_setup(struct obd_device *obddev, obd_count len,
         int err;
         ENTRY;
 
-        if (data->ioc_dev  < 0 || data->ioc_dev > MAX_OBD_DEVICES)
+        if (data->ioc_dev < 0 || data->ioc_dev > MAX_OBD_DEVICES)
                 RETURN(-ENODEV);
 
         MOD_INC_USE_COUNT;
         tgt = &obd_dev[data->ioc_dev];
         ost->ost_tgt = tgt;
-        if ( ! (tgt->obd_flags & OBD_ATTACHED) ||
-             ! (tgt->obd_flags & OBD_SET_UP) ){
+        if (!(tgt->obd_flags & OBD_ATTACHED) ||
+            !(tgt->obd_flags & OBD_SET_UP)) {
                 CERROR("device not attached or not set up (%d)\n",
                        data->ioc_dev);
                 GOTO(error_dec, err = -EINVAL);
@@ -609,9 +606,8 @@ static int ost_setup(struct obd_device *obddev, obd_count len,
         }
 
         err = ptlrpc_start_thread(obddev, ost->ost_service, "lustre_ost");
-        if (err) {
+        if (err)
                 GOTO(error_disc, err = -EINVAL);
-        }
 
         RETURN(0);
 
index 23a3b9f..2be7a3c 100644 (file)
@@ -24,8 +24,7 @@
 
 #define DEBUG_SUBSYSTEM S_RPC
 
-#include <linux/lustre_net.h>
-
+#include <linux/lustre_ha.h>
 
 void ptlrpc_init_client(struct connmgr_obd *mgr, int req_portal,
                         int rep_portal, struct ptlrpc_client *cl)
index a663a44..cd7f4a2 100644 (file)
  */
 
 #define EXPORT_SYMTAB
-
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <linux/locks.h>
-#include <linux/kmod.h>
-#include <linux/quotaops.h>
-#include <asm/unistd.h>
-#include <asm/uaccess.h>
-
 #define DEBUG_SUBSYSTEM S_RPC
 
+#include <linux/kmod.h>
 #include <linux/lustre_lite.h>
 #include <linux/lustre_ha.h>
-#include <linux/lustre_lib.h>
-#include <linux/lustre_net.h>
 
-struct connmgr_obd *ptlrpc_connmgr; 
+struct connmgr_obd *ptlrpc_connmgr;
 
 void connmgr_cli_manage(struct connmgr_obd *mgr, struct ptlrpc_client *cli)
 {
         ENTRY;
         cli->cli_ha_mgr = mgr;
         spin_lock(&mgr->mgr_lock);
-        list_add(&cli->cli_ha_item, &mgr->mgr_connections_lh); 
-        spin_unlock(&mgr->mgr_lock); 
+        list_add(&cli->cli_ha_item, &mgr->mgr_connections_lh);
+        spin_unlock(&mgr->mgr_lock);
         EXIT;
 }
 
-
 void connmgr_cli_fail(struct ptlrpc_client *cli)
 {
         ENTRY;
-        spin_lock(&cli->cli_ha_mgr->mgr_lock); 
+        spin_lock(&cli->cli_ha_mgr->mgr_lock);
         cli->cli_ha_mgr->mgr_flags |= SVC_HA_EVENT;
         list_del(&cli->cli_ha_item);
-        list_add(&cli->cli_ha_item, &cli->cli_ha_mgr->mgr_troubled_lh); 
-        spin_unlock(&cli->cli_ha_mgr->mgr_lock); 
+        list_add(&cli->cli_ha_item, &cli->cli_ha_mgr->mgr_troubled_lh);
+        spin_unlock(&cli->cli_ha_mgr->mgr_lock);
         wake_up(&cli->cli_ha_mgr->mgr_waitq);
         EXIT;
 }
 
-int connmgr_upcall(void)
+static int connmgr_upcall(void)
 {
         char *argv[2];
         char *envp[3];
@@ -82,8 +69,7 @@ static void connmgr_unpack_body(struct ptlrpc_request *req)
         b->generation = NTOH__u32(b->generation);
 }
 
-int connmgr_connect(struct connmgr_obd *mgr, 
-                    struct ptlrpc_connection *conn)
+int connmgr_connect(struct connmgr_obd *mgr, struct ptlrpc_connection *conn)
 {
         struct ptlrpc_request *req;
         struct ptlrpc_client *cl;
@@ -91,8 +77,8 @@ int connmgr_connect(struct connmgr_obd *mgr,
         int rc, size = sizeof(*body);
         ENTRY;
 
-        if (!mgr) { 
-                CERROR("no manager\n"); 
+        if (!mgr) {
+                CERROR("no manager\n");
                 LBUG();
         }
         cl = mgr->mgr_client;
@@ -103,25 +89,28 @@ int connmgr_connect(struct connmgr_obd *mgr,
 
         body = lustre_msg_buf(req->rq_reqmsg, 0);
         body->generation = HTON__u32(conn->c_generation);
+        body->conn = (__u64)(unsigned long)conn;
+        body->conn_token = conn->c_token;
 
         req->rq_replen = lustre_msg_size(1, &size);
 
         rc = ptlrpc_queue_wait(req);
         rc = ptlrpc_check_status(req, rc);
-
         if (!rc) {
                 connmgr_unpack_body(req);
                 body = lustre_msg_buf(req->rq_repmsg, 0);
                 CDEBUG(D_NET, "mode: %o\n", body->generation);
+                conn->c_remote_conn = body->conn;
+                conn->c_remote_token = body->conn_token;
         }
 
+        ptlrpc_free_req(req);
         EXIT;
  out:
         return rc;
 }
 
-
-int connmgr_handle_connect(struct ptlrpc_request *req)
+static int connmgr_handle_connect(struct ptlrpc_request *req)
 {
         struct connmgr_body *body;
         int rc, size = sizeof(*body);
@@ -135,36 +124,41 @@ int connmgr_handle_connect(struct ptlrpc_request *req)
         }
 
         body = lustre_msg_buf(req->rq_reqmsg, 0);
-        connmgr_unpack_body(req); 
+        connmgr_unpack_body(req);
+
+        req->rq_connection->c_remote_conn = body->conn;
+        req->rq_connection->c_remote_token = body->conn_token;
 
-        printk("incoming generation %d\n", body->generation);
+        CERROR("incoming generation %d\n", body->generation);
         body = lustre_msg_buf(req->rq_repmsg, 0);
         body->generation = 4711;
+        body->conn = (__u64)(unsigned long)req->rq_connection;
+        body->conn_token = req->rq_connection->c_token;
+
         RETURN(0);
 }
 
-int connmgr_handle(struct obd_device *dev,
-                   struct ptlrpc_service *svc,
+int connmgr_handle(struct obd_device *dev, struct ptlrpc_service *svc,
                    struct ptlrpc_request *req)
 {
         int rc;
         ENTRY;
 
         rc = lustre_unpack_msg(req->rq_reqmsg, req->rq_reqlen);
-        if (rc) { 
-                CERROR("lustre_mds: Invalid request\n");
+        if (rc) {
+                CERROR("Invalid request\n");
                 GOTO(out, rc);
         }
 
         if (req->rq_reqmsg->type != PTL_RPC_REQUEST) {
-                CERROR("lustre_mds: wrong packet type sent %d\n",
+                CERROR("wrong packet type sent %d\n",
                        req->rq_reqmsg->type);
                 GOTO(out, rc = -EINVAL);
         }
 
         switch (req->rq_reqmsg->opc) {
         case CONNMGR_CONNECT:
-                CDEBUG(D_INODE, "getattr\n");
+                CDEBUG(D_INODE, "connect\n");
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_GETATTR_NET, 0);
                 rc = connmgr_handle_connect(req);
                 break;
@@ -186,68 +180,65 @@ out:
         return 0;
 }
 
-
 static int recovd_check_event(struct connmgr_obd *mgr)
 {
-        int rc = 0; 
+        int rc = 0;
         ENTRY;
 
         spin_lock(&mgr->mgr_lock);
 
-        if (!(mgr->mgr_flags & MGR_WORKING) && 
-            !list_empty(&mgr->mgr_troubled_lh) ) {
+        if (!(mgr->mgr_flags & MGR_WORKING) &&
+            !list_empty(&mgr->mgr_troubled_lh)) {
 
-                CERROR("connection in trouble - state: WORKING, upcall\n"); 
+                CERROR("connection in trouble - state: WORKING, upcall\n");
                 mgr->mgr_flags = MGR_WORKING;
 
-                mgr->mgr_waketime = CURRENT_TIME; 
+                mgr->mgr_waketime = CURRENT_TIME;
                 mgr->mgr_timeout = 5 * HZ;
-                schedule_timeout(mgr->mgr_timeout); 
+                schedule_timeout(mgr->mgr_timeout);
 
         }
 
         if (mgr->mgr_flags & MGR_WORKING &&
-            CURRENT_TIME <= mgr->mgr_waketime + mgr->mgr_timeout ) { 
+            CURRENT_TIME <= mgr->mgr_waketime + mgr->mgr_timeout) {
                 CERROR("WORKING: new event\n");
 
-                mgr->mgr_waketime = CURRENT_TIME; 
-                schedule_timeout(mgr->mgr_timeout); 
+                mgr->mgr_waketime = CURRENT_TIME;
+                schedule_timeout(mgr->mgr_timeout);
         }
 
-        if (mgr->mgr_flags & MGR_STOPPING) { 
+        if (mgr->mgr_flags & MGR_STOPPING) {
                 CERROR("ha mgr stopping\n");
                 rc = 1;
         }
 
-        spin_unlock(&mgr->mgr_lock); 
+        spin_unlock(&mgr->mgr_lock);
         RETURN(rc);
 }
 
-int recovd_handle_event(struct connmgr_obd *mgr)
+static int recovd_handle_event(struct connmgr_obd *mgr)
 {
-
         spin_lock(&mgr->mgr_lock);
 
-        if (!(mgr->mgr_flags & MGR_WORKING) && 
-            !list_empty(&mgr->mgr_troubled_lh) ) {
+        if (!(mgr->mgr_flags & MGR_WORKING) &&
+            !list_empty(&mgr->mgr_troubled_lh)) {
 
-                CERROR("connection in trouble - state: WORKING, upcall\n"); 
+                CERROR("connection in trouble - state: WORKING, upcall\n");
                 mgr->mgr_flags = MGR_WORKING;
 
 
                 connmgr_upcall();
-                mgr->mgr_waketime = CURRENT_TIME; 
+                mgr->mgr_waketime = CURRENT_TIME;
                 mgr->mgr_timeout = 5 * HZ;
-                schedule_timeout(mgr->mgr_timeout); 
-
+                schedule_timeout(mgr->mgr_timeout);
         }
 
         if (mgr->mgr_flags & MGR_WORKING &&
-            CURRENT_TIME <= mgr->mgr_waketime + mgr->mgr_timeout ) { 
+            CURRENT_TIME <= mgr->mgr_waketime + mgr->mgr_timeout) {
                 CERROR("WORKING: new event\n");
 
-                mgr->mgr_waketime = CURRENT_TIME; 
-                schedule_timeout(mgr->mgr_timeout); 
+                mgr->mgr_waketime = CURRENT_TIME;
+                schedule_timeout(mgr->mgr_timeout);
         }
 
         spin_unlock(&mgr->mgr_lock);
@@ -277,18 +268,18 @@ static int recovd_main(void *arg)
 
         /* And now, loop forever on requests */
         while (1) {
-                wait_event_interruptible(mgr->mgr_waitq, 
+                wait_event_interruptible(mgr->mgr_waitq,
                                          recovd_check_event(mgr));
 
                 spin_lock(&mgr->mgr_lock);
                 if (mgr->mgr_flags & MGR_STOPPING) {
                         spin_unlock(&mgr->mgr_lock);
-                        CERROR("lustre_hamgr quitting\n"); 
+                        CERROR("lustre_hamgr quitting\n");
                         EXIT;
                         break;
                 }
 
-                recovd_handle_event(mgr); 
+                recovd_handle_event(mgr);
                 spin_unlock(&mgr->mgr_lock);
         }
 
@@ -307,7 +298,7 @@ int recovd_setup(struct connmgr_obd *mgr)
 
         INIT_LIST_HEAD(&mgr->mgr_connections_lh);
         INIT_LIST_HEAD(&mgr->mgr_troubled_lh);
-        spin_lock_init(&mgr->mgr_lock); 
+        spin_lock_init(&mgr->mgr_lock);
 
         d.mgr = mgr;
         d.name = "lustre_recovd";
@@ -323,10 +314,9 @@ int recovd_setup(struct connmgr_obd *mgr)
         }
         wait_event(mgr->mgr_ctl_waitq, mgr->mgr_flags & MGR_RUNNING);
 
-        RETURN(0); 
+        RETURN(0);
 }
 
-
 int recovd_cleanup(struct connmgr_obd *mgr)
 {
         mgr->mgr_flags = MGR_STOPPING;
index 67c988f..e1bc4fc 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_RPC
 
-#include <linux/lustre_net.h>
-
-extern int connmgr_handle(struct obd_device *dev,
-                          struct ptlrpc_service *svc,
-                          struct ptlrpc_request *req);
+#include <linux/lustre_ha.h>
 
 extern int ptlrpc_init_portals(void);
 extern void ptlrpc_exit_portals(void);
 
-extern int recovd_setup(struct connmgr_obd *mgr);
-extern int recovd_cleanup(struct connmgr_obd *mgr);
-
-
 int connmgr_setup(struct obd_device *obddev, obd_count len, void *buf)
 {
         struct connmgr_obd *mgr = &obddev->u.mgr;
@@ -55,9 +47,9 @@ int connmgr_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (err)
                 GOTO(err_free, err);
 
-        mgr->mgr_service = ptlrpc_init_svc
-                (128 * 1024,CONNMGR_REQUEST_PORTAL, CONNMGR_REPLY_PORTAL,
-                 "self", connmgr_handle);
+        mgr->mgr_service =
+                ptlrpc_init_svc(128 * 1024,CONNMGR_REQUEST_PORTAL,
+                                CONNMGR_REPLY_PORTAL, "self", connmgr_handle);
         if (!mgr->mgr_service) {
                 CERROR("failed to start service\n");
                 GOTO(err_recovd, err = -EINVAL);
@@ -86,7 +78,6 @@ int connmgr_setup(struct obd_device *obddev, obd_count len, void *buf)
         RETURN(err);
 }
 
-
 int connmgr_cleanup(struct obd_device *dev)
 {
         struct connmgr_obd *mgr = &dev->u.mgr;
@@ -106,7 +97,7 @@ int connmgr_cleanup(struct obd_device *dev)
         OBD_FREE(mgr->mgr_service, sizeof(*mgr->mgr_service));
         mgr->mgr_flags = MGR_STOPPING;
 
-        PORTAL_FREE(mgr->mgr_client, sizeof(*mgr->mgr_client));
+        OBD_FREE(mgr->mgr_client, sizeof(*mgr->mgr_client));
         MOD_DEC_USE_COUNT;
         RETURN(0);
 }
index afe230d..5a23889 100644 (file)
  */
 
 #define EXPORT_SYMTAB
-
 #define DEBUG_SUBSYSTEM S_RPC
 
 #include <linux/lustre_net.h>
 
 extern int request_in_callback(ptl_event_t *ev, void *data);
 extern int ptl_handled_rpc(struct ptlrpc_service *service, void *start);
-extern int connmgr_handle_event(struct obd_device *dev, struct ptlrpc_service *);
 
 static int ptlrpc_check_event(struct ptlrpc_service *svc)
 {
         int rc = 0;
+        ENTRY;
 
         spin_lock(&svc->srv_lock);
         if (sigismember(&(current->pending.signal), SIGKILL) ||
@@ -75,6 +74,7 @@ ptlrpc_init_svc(__u32 bufsize, int req_portal, int rep_portal, char *uuid,
         int err;
         int rc, i;
         struct ptlrpc_service *service;
+        ENTRY;
 
         OBD_ALLOC(service, sizeof(*service));
         if (!service) {
@@ -105,8 +105,7 @@ ptlrpc_init_svc(__u32 bufsize, int req_portal, int rep_portal, char *uuid,
         service->srv_id.nid = PTL_ID_ANY;
         service->srv_id.pid = PTL_ID_ANY;
 
-        rc = PtlEQAlloc(service->srv_self.peer_ni, 128,
-                        request_in_callback,
+        rc = PtlEQAlloc(service->srv_self.peer_ni, 128, request_in_callback,
                         service, &(service->srv_eq_h));
 
         if (rc != PTL_OK) {
@@ -129,7 +128,7 @@ ptlrpc_init_svc(__u32 bufsize, int req_portal, int rep_portal, char *uuid,
         CDEBUG(D_NET, "Starting service listening on portal %d\n",
                service->srv_req_portal);
 
-        return service;
+        RETURN(service);
 err_ring:
         service->srv_ring_length = i;
         rpc_unregister_service(service); // XXX verify this is right
@@ -166,10 +165,6 @@ static int handle_incoming_request(struct obd_device *obddev,
          * We don't know how to find that from here. */
         peer.peer_ni = svc->srv_self.peer_ni;
 
-        /* FIXME: rq_reqmsg->conn should be, if nonzero, the local connection
-         * structure.  Until we have the HA connect messages that we talked
-         * about, however, we don't have a way to exchange that address/token
-         * pair and this will always be zero. */
         if (request.rq_reqmsg->conn) {
                 request.rq_connection =
                         (void *)(unsigned long)request.rq_reqmsg->conn;
index ec535d4..67c7f0c 100644 (file)
@@ -14,9 +14,15 @@ setup_lustre
 
 $OBDCTL <<EOF
 device 0
+attach ptlrpc
+setup
+device 1
+attach ldlm
+setup
+device 2
 attach osc
 setup -1
 quit
 EOF
 
-mount -t lustre_lite -o device=0 none /mnt/lustre
+mount -t lustre_lite -o device=2 none /mnt/lustre
index a1a76cc..9b92636 100644 (file)
@@ -29,5 +29,11 @@ setup ${OST}
 device 2
 attach ost
 setup 1
+device 3
+attach ptlrpc
+setup
+device 4
+attach ldlm
+setup
 quit
 EOF
index 877f9a3..7fcd68b 100755 (executable)
@@ -31,12 +31,15 @@ device 2
 attach ost
 setup 1
 device 3
-attach osc
-setup -1
-device 4
 attach ptlrpc
 setup
+device 4
+attach ldlm
+setup
+device 5
+attach osc
+setup -1
 quit
 EOF
 
-mount -t lustre_lite -o device=3 none /mnt/lustre
+mount -t lustre_lite -o device=5 none /mnt/lustre
index 523c219..aa8f8b1 100755 (executable)
@@ -10,6 +10,9 @@ rmmod llite
 rmmod mdc
 
 $OBDCTL <<EOF
+device 5
+cleanup
+detach
 device 4
 cleanup
 detach
index 5f2de74..4dbd546 100755 (executable)
@@ -30,12 +30,15 @@ device 2
 attach ost
 setup 1
 device 3
-attach osc
-setup -1
-device 4
 attach ptlrpc
 setup
+device 4
+attach ldlm
+setup
+device 5
+attach osc
+setup -1
 quit
 EOF
 
-mount -t lustre_lite -o device=3 none /mnt/lustre
+mount -t lustre_lite -o device=5 none /mnt/lustre