]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rework client mount slightly
authorSage Weil <sage@newdream.net>
Tue, 15 Jan 2008 19:09:49 +0000 (11:09 -0800)
committerSage Weil <sage@newdream.net>
Tue, 15 Jan 2008 19:09:49 +0000 (11:09 -0800)
src/kernel/client.c
src/kernel/client.h
src/kernel/messenger.c
src/kernel/super.c

index 4d855e7274d1f6c552a94cf3eb23a5157000d1ea..eba69331dbb99fe42fc570a2727b97552ec7b24a 100644 (file)
@@ -98,15 +98,15 @@ fail:
 /*
  * mount: join the ceph cluster.
  */
-static int mount(struct ceph_client *client, struct ceph_mount_args *args)
+int ceph_mount(struct ceph_client *client, struct ceph_mount_args *args)
 {
        struct ceph_msg *mount_msg;
        int err;
        int attempts = 10;
        int which;
        char r;
-       
-       client->mounting = 0;  /* wait for mon+mds+osd */
+
+       dout(10, "mount start\n");
 
        /* send mount request */
 trymount:
@@ -182,7 +182,6 @@ static struct ceph_client *get_client_monaddr(struct ceph_entity_addr *monaddr)
 struct ceph_client *ceph_create_client(struct ceph_mount_args *args, struct super_block *sb)
 {
        struct ceph_client *client = 0;
-       int ret;
 
        /* create new client */
        client = create_client(args);
@@ -191,12 +190,8 @@ struct ceph_client *ceph_create_client(struct ceph_mount_args *args, struct supe
        atomic_inc(&client->nref);
        client->sb = sb;
 
-       /* request mount */
-       ret = mount(client, args);
-       if (ret < 0) {
-               ceph_put_client(client);
-               return ERR_PTR(ret);
-       }
+       client->mounting = 0;  /* wait for mon+mds+osd */
+
        return client;
 }
 
index fe0e7b168ea295e149d54a4b560ea897056f2ce4..f856f9d7639bfc4e2a1d9efcbab8b1151af21d05 100644 (file)
@@ -57,5 +57,6 @@ struct ceph_client {
 
 extern struct ceph_client *ceph_create_client(struct ceph_mount_args *args, struct super_block *sb);
 extern void ceph_put_client(struct ceph_client *cl);
+extern int ceph_mount(struct ceph_client *client, struct ceph_mount_args *args);
 
 #endif
index 9066597d5e18e2a3ccfd670f44a3d8257ea11f54..8375c45361d6a9ef14d2143fc5887f13427f6263 100644 (file)
@@ -478,7 +478,7 @@ more:
                set_bit(CONNECTING, &con->state);
                dout(5, "try_write initiating connect on %p new state %lu\n", con, con->state);
                ret = ceph_tcp_connect(con);
-               dout(5, "try_write initiated connect ret = %d\n state = %lu", ret, con->state);
+               dout(5, "try_write initiated connect ret = %d state = %lu\n", ret, con->state);
                if (ret < 0) {
                        /* fault */
                        derr(1, "connect error\n");
index 89464a91309a951454d7274e47b1e8f81d860485..e52bc1cad7451a00a0540132982e0cdaa1574efd 100644 (file)
@@ -518,6 +518,12 @@ static int ceph_get_sb(struct file_system_type *fs_type,
        }
        sbinfo = ceph_sbinfo(sb);
 
+       /* request mount */
+       if (sbinfo->sb_client->mounting < 7) {
+               if ((err = ceph_mount(sbinfo->sb_client, &mount_args)) < 0)
+                       goto out_splat;
+       }
+
        /* open root */
        dout(30, "ceph_get_sb opening base mountpoint\n");
        if ((err = open_root_inode(sb, &mount_args)) < 0)