/*
* 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:
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);
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;
}
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
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");
}
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)