mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
allow multiclient nodes to mount
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1566 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
d32f177b35
commit
0759800318
@ -128,6 +128,9 @@ Client::Client(Messenger *m, MonMap *mm) : timer(client_lock)
|
||||
objecter->set_client_incarnation(0); // client always 0, for now.
|
||||
objectcacher = new ObjectCacher(objecter, client_lock);
|
||||
filer = new Filer(objecter);
|
||||
|
||||
static int instance_this_process = 0;
|
||||
client_instance_this_process = instance_this_process++;
|
||||
}
|
||||
|
||||
|
||||
@ -848,7 +851,7 @@ void Client::dispatch(Message *m)
|
||||
|
||||
case MSG_OSD_MAP:
|
||||
objecter->handle_osd_map((class MOSDMap*)m);
|
||||
mount_cond.Signal();
|
||||
if (!mounted) mount_cond.Signal();
|
||||
break;
|
||||
|
||||
// mounting and mds sessions
|
||||
@ -1305,7 +1308,8 @@ void Client::_try_mount()
|
||||
dout(10) << "_try_mount" << endl;
|
||||
int mon = monmap->pick_mon();
|
||||
dout(2) << "sending client_mount to mon" << mon << endl;
|
||||
messenger->send_message(new MClientMount(messenger->get_myaddr()),
|
||||
messenger->send_message(new MClientMount(messenger->get_myaddr(),
|
||||
client_instance_this_process),
|
||||
monmap->get_inst(mon));
|
||||
|
||||
// schedule timeout
|
||||
|
@ -387,6 +387,7 @@ class Client : public Dispatcher {
|
||||
bool mounted;
|
||||
bool unmounting;
|
||||
Cond mount_cond;
|
||||
int client_instance_this_process;
|
||||
|
||||
int unsafe_sync_write;
|
||||
public:
|
||||
|
@ -20,20 +20,23 @@
|
||||
class MClientMount : public Message {
|
||||
public:
|
||||
entity_addr_t addr;
|
||||
int instance; // on this node
|
||||
|
||||
MClientMount() : Message(MSG_CLIENT_MOUNT) { }
|
||||
MClientMount(entity_addr_t a) :
|
||||
MClientMount(entity_addr_t a, int i = 0) :
|
||||
Message(MSG_CLIENT_MOUNT),
|
||||
addr(a) { }
|
||||
addr(a), instance(i) { }
|
||||
|
||||
char *get_type_name() { return "client_mount"; }
|
||||
|
||||
void decode_payload() {
|
||||
int off = 0;
|
||||
::_decode(addr, payload, off);
|
||||
::_decode(instance, payload, off);
|
||||
}
|
||||
void encode_payload() {
|
||||
::_encode(addr, payload);
|
||||
::_encode(instance, payload);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -119,8 +119,10 @@ bool ClientMonitor::preprocess_query(Message *m)
|
||||
case MSG_CLIENT_MOUNT:
|
||||
{
|
||||
// already mounted?
|
||||
MClientMount *mount = (MClientMount*)m;
|
||||
entity_addr_t addr = m->get_source_addr();
|
||||
if (client_map.addr_client.count(addr)) {
|
||||
if (mount->instance == 0 && // only check for addr uniqueness if the client claims to be alone
|
||||
client_map.addr_client.count(addr)) {
|
||||
int client = client_map.addr_client[addr];
|
||||
dout(7) << " client" << client << " already mounted" << endl;
|
||||
_mounted(client, (MClientMount*)m);
|
||||
|
Loading…
Reference in New Issue
Block a user