/* wait */
dout(10, "mount sent mount request, waiting for maps\n");
- err = wait_for_completion_timeout(&client->mount_completion,
- 6*HZ);
+ //err = wait_for_completion_timeout(&client->mount_completion,
+ //6*HZ);
+ err = wait_event_interruptible_timeout(
+ client->mount_wq,
+ ceph_have_all_maps(client),
+ 6*HZ);
+ dout(10, "mount wait got %d\n", err);
if (err == -EINTR)
return err;
- if (client->mounting == 7)
+ if (ceph_have_all_maps(client))
break; /* success */
dout(10, "mount still waiting for mount, attempts=%d\n",
attempts);
void got_first_map(struct ceph_client *client, int num)
{
set_bit(num, &client->mounting);
- dout(10, "got_first_map num %d mounting now %lu bits %d\n",
- num, client->mounting, (int)find_first_zero_bit(&client->mounting, 4));
- if (find_first_zero_bit(&client->mounting, 4) == 3) {
+ dout(10, "got_first_map num %d mounting now %lu done=%d\n",
+ num, client->mounting, ceph_have_all_maps(client));
+ if (ceph_have_all_maps(client)) {
dout(10, "got_first_map kicking mount\n");
- complete(&client->mount_completion);
+ wake_up(&client->mount_wq);
}
}
if (cl == NULL)
return ERR_PTR(-ENOMEM);
- init_completion(&cl->mount_completion);
+ init_waitqueue_head(&cl->mount_wq);
spin_lock_init(&cl->sb_lock);
get_client_counter();
if (myaddr)
msgr->inst.addr.ipaddr.sin_addr = myaddr->ipaddr.sin_addr;
- dout(1, "create %p listening on %x:%d\n", msgr,
- ntohl(msgr->inst.addr.ipaddr.sin_addr.s_addr),
- ntohs(msgr->inst.addr.ipaddr.sin_port));
+ dout(1, "create %p listening on %u.%u.%u.%u:%u\n", msgr,
+ IPQUADPORT(msgr->inst.addr.ipaddr));
return msgr;
}
#define CEPH_BLOCK (1 << CEPH_BLOCK_SHIFT)
#define IPQUADPORT(n) \
- (unsigned int)((n.sin_addr.s_addr)) & 0xFF, \
- (unsigned int)((n.sin_addr.s_addr)>>8) & 0xFF, \
- (unsigned int)((n.sin_addr.s_addr)>>16) & 0xFF, \
- (unsigned int)((n.sin_addr.s_addr)>>24) & 0xFF, \
- (unsigned int)(ntohs(n.sin_port))
+ (unsigned int)(((n).sin_addr.s_addr)) & 0xFF, \
+ (unsigned int)(((n).sin_addr.s_addr)>>8) & 0xFF, \
+ (unsigned int)(((n).sin_addr.s_addr)>>16) & 0xFF, \
+ (unsigned int)(((n).sin_addr.s_addr)>>24) & 0xFF, \
+ (unsigned int)(ntohs((n).sin_port))
/*
* mount options
struct super_block *sb;
unsigned long mounting; /* map bitset; 4=mon, 2=mds, 1=osd map */
- struct completion mount_completion;
-
+ wait_queue_head_t mount_wq;
+
struct ceph_messenger *msgr; /* messenger instance */
struct ceph_mon_client monc;
struct ceph_mds_client mdsc;
struct list_head sb_list;
};
+static inline int ceph_have_all_maps(struct ceph_client *client)
+{
+ return find_first_zero_bit(&client->mounting, 4) == 3;
+}
+
/*
* CEPH per-mount superblock info
*/