From 25ccfe6ade7d60cf4f5bd55e2ef5188e72632459 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 15 Jan 2008 11:09:49 -0800 Subject: [PATCH] rework client mount slightly --- src/kernel/client.c | 15 +++++---------- src/kernel/client.h | 1 + src/kernel/messenger.c | 2 +- src/kernel/super.c | 6 ++++++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/kernel/client.c b/src/kernel/client.c index 4d855e7274d1f..eba69331dbb99 100644 --- a/src/kernel/client.c +++ b/src/kernel/client.c @@ -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; } diff --git a/src/kernel/client.h b/src/kernel/client.h index fe0e7b168ea29..f856f9d7639bf 100644 --- a/src/kernel/client.h +++ b/src/kernel/client.h @@ -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 diff --git a/src/kernel/messenger.c b/src/kernel/messenger.c index 9066597d5e18e..8375c45361d6a 100644 --- a/src/kernel/messenger.c +++ b/src/kernel/messenger.c @@ -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"); diff --git a/src/kernel/super.c b/src/kernel/super.c index 89464a91309a9..e52bc1cad7451 100644 --- a/src/kernel/super.c +++ b/src/kernel/super.c @@ -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) -- 2.39.5