From f6d9a0a9d0a26acfae49540d93fec1f578c7499d Mon Sep 17 00:00:00 2001 From: sage Date: Mon, 9 Aug 2004 16:27:48 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@77 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/client/Client.cc | 11 +++++++++-- ceph/client/Client.h | 1 + ceph/config.cc | 2 +- ceph/mds/MDS.cc | 14 ++++++++------ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ceph/client/Client.cc b/ceph/client/Client.cc index 37249707b5e75..137dafb5d13a9 100644 --- a/ceph/client/Client.cc +++ b/ceph/client/Client.cc @@ -254,9 +254,9 @@ void Client::issue_request() int r = rand() % 100; if (r < 10) op = MDS_OP_TOUCH; - else if (r < 20) + else if (r < 20 && !is_open(cwd)) op = MDS_OP_OPENRD; - else if (r < 30) + else if (r < 30 && !is_open(cwd)) op = MDS_OP_OPENWR; else if (r < 40 + open_files.size() && open_files.size() > 0) { // close file @@ -270,6 +270,13 @@ void Client::issue_request() } +bool Client::is_open(ClNode *c) +{ + if (open_files.count(c->ino)) + return true; + return false; +} + void Client::close_a_file() { multimap::iterator it = open_files.begin(); diff --git a/ceph/client/Client.h b/ceph/client/Client.h index fb95942c15e30..7c3d065ccdbaf 100644 --- a/ceph/client/Client.h +++ b/ceph/client/Client.h @@ -49,6 +49,7 @@ class Client : public Dispatcher { virtual void send_request(string& p, int op); void close_a_file(); + bool is_open(ClNode *n); virtual void trim_cache(); }; diff --git a/ceph/config.cc b/ceph/config.cc index a017153dc670d..dfb575536121e 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -28,7 +28,7 @@ md_config_t g_conf = { fake_clock: true, - debug: 1, + debug: 10, mdcache_size: MDS_CACHE_SIZE, mdcache_mid: .8, diff --git a/ceph/mds/MDS.cc b/ceph/mds/MDS.cc index 027d006679228..0e90325c216d3 100644 --- a/ceph/mds/MDS.cc +++ b/ceph/mds/MDS.cc @@ -588,7 +588,8 @@ MClientReply *MDS::handle_client_openrd(MClientRequest *req, // hmm, check permissions or something. // add reader - cur->open_read_add(MSG_ADDR_NUM(req->get_source())); + int client = req->get_client(); + cur->open_read_add(client); // reply MClientReply *reply = new MClientReply(req); @@ -606,7 +607,7 @@ void MDS::handle_client_close(MClientRequest *req) // hmm, check permissions or something. // verify on read or write list - int client = MSG_ADDR_NUM(req->get_source()); + int client = req->get_client(); if (!cur->open_remove(client)) { dout(1) << "close on unopen file " << *cur << endl; assert(2+2==5); @@ -627,9 +628,7 @@ void MDS::handle_client_close(MClientRequest *req) MClientReply *MDS::handle_client_openwr(MClientRequest *req, CInode *cur) { - if (cur->is_auth()) { - dout(10) << "open (write) [auth] " << *cur << endl; - } else { + if (!cur->is_auth()) { if (!cur->is_softasync()) { int auth = cur->authority(get_cluster()); assert(auth != whoami); @@ -645,10 +644,13 @@ MClientReply *MDS::handle_client_openwr(MClientRequest *req, assert(0); } + dout(10) << "open (write) [auth] " << *cur << endl; + // hmm, check permissions! // add to writer list. - cur->open_write_add(MSG_ADDR_NUM(req->get_source())); + int client = req->get_client(); + cur->open_write_add(client); // reply MClientReply *reply = new MClientReply(req); -- 2.39.5