From a60cdad6ff26c0c8513ad637d8d9dba9e99871d9 Mon Sep 17 00:00:00 2001 From: anwleung Date: Fri, 23 Feb 2007 00:53:47 +0000 Subject: [PATCH] Changed cap cache handling git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1119 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/aleung/security1/ceph/client/Client.cc | 6 ++---- branches/aleung/security1/ceph/client/Client.h | 6 +++--- branches/aleung/security1/ceph/mds/Locker.cc | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/branches/aleung/security1/ceph/client/Client.cc b/branches/aleung/security1/ceph/client/Client.cc index cf8d93b67aa8a..c3e2a33c36d83 100644 --- a/branches/aleung/security1/ceph/client/Client.cc +++ b/branches/aleung/security1/ceph/client/Client.cc @@ -2435,13 +2435,13 @@ int Client::open(const char *relpath, int flags, __int64_t uid, __int64_t gid) // need security caps? check if I even asked for one ExtCap ext_cap = reply->get_ext_cap(); - cout << "Received a " << ext_cap.mode() << " capability for uid: " + dout(3) << "Received a " << ext_cap.mode() << " capability for uid: " << ext_cap.get_uid() << " for inode: " << ext_cap.get_ino() << endl; assert(ext_cap.verif_extcap(monmap->get_key())); // cache it - f->inode->set_ext_cap(uid, ext_cap); + f->inode->set_ext_cap(uid, &ext_cap); assert(reply->get_file_caps_seq() >= f->inode->caps[mds].seq); if (reply->get_file_caps_seq() > f->inode->caps[mds].seq) { @@ -2479,9 +2479,7 @@ int Client::open(const char *relpath, int flags, __int64_t uid, __int64_t gid) dout(0) << "open failure result " << result << endl; } - cout << "Before delete!!" << endl << endl; delete reply; - cout << "After delete!!" << endl << endl; put_user_ticket(tk); trim_cache(); diff --git a/branches/aleung/security1/ceph/client/Client.h b/branches/aleung/security1/ceph/client/Client.h index a454aa87175f3..10bed373128f7 100644 --- a/branches/aleung/security1/ceph/client/Client.h +++ b/branches/aleung/security1/ceph/client/Client.h @@ -153,7 +153,7 @@ class Inode { string *symlink; // symlink content, if it's a symlink // secure caps - map ext_cap_cache; + map ext_cap_cache; // for caching i/o mode FileCache fc; @@ -196,10 +196,10 @@ class Inode { return (inode.mode & INODE_TYPE_MASK) == INODE_MODE_DIR; } - void set_ext_cap(uid_t user, ExtCap *ecap) { ext_cap_cache[user] = ecap; } + void set_ext_cap(uid_t user, ExtCap *ecap) { ext_cap_cache[user] = (*ecap); } ExtCap* get_ext_cap(uid_t user) { if (ext_cap_cache.count(user)) - return ext_cap_cache[user]; + return &(ext_cap_cache[user]); return 0; } diff --git a/branches/aleung/security1/ceph/mds/Locker.cc b/branches/aleung/security1/ceph/mds/Locker.cc index 49a82594689dc..b182bb411bc92 100644 --- a/branches/aleung/security1/ceph/mds/Locker.cc +++ b/branches/aleung/security1/ceph/mds/Locker.cc @@ -203,7 +203,7 @@ ExtCap* Locker::issue_new_extcaps(CInode *in, int mode, MClientRequest *req) { // make new cap ext_cap = new ExtCap(my_want, my_user, in->ino()); - cout << "Made new " << my_want << " capability for uid: " + dout(3) << "Made new " << my_want << " capability for uid: " << ext_cap->get_uid() << " for inode: " << ext_cap->get_ino()<< endl; ext_cap->sign_extcap(mds->getPrvKey()); @@ -215,7 +215,7 @@ ExtCap* Locker::issue_new_extcaps(CInode *in, int mode, MClientRequest *req) { // we want to index based on mode, so we can cache more caps // does the cached cap have the write mode? else { - cout << "Got cached " << my_want << " capability for uid: " + dout(3) << "Got cached " << my_want << " capability for uid: " << ext_cap->get_uid() << " for inode: " << ext_cap->get_ino() << endl; if (ext_cap->mode() < mode) { ext_cap->set_mode(mode); -- 2.39.5