From 48d55ae08288a4cb4d1347907d5d40bb4fd8b904 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 15 May 2007 20:55:38 +0000 Subject: [PATCH] * fixed caps on open idiocy git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1356 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/cephmds2/client/Client.cc | 4 +++- branches/sage/cephmds2/mds/Locker.cc | 8 ++++---- branches/sage/cephmds2/messages/MClientFileCaps.h | 8 ++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/branches/sage/cephmds2/client/Client.cc b/branches/sage/cephmds2/client/Client.cc index 7880a7bd9bfe6..bcf763ce6e162 100644 --- a/branches/sage/cephmds2/client/Client.cc +++ b/branches/sage/cephmds2/client/Client.cc @@ -2321,13 +2321,15 @@ int Client::open(const char *relpath, int flags, mode_t mode) assert(reply->get_file_caps_seq() >= f->inode->caps[mds].seq); if (reply->get_file_caps_seq() > f->inode->caps[mds].seq) { + int old_caps = f->inode->caps[mds].caps; + dout(7) << "open got caps " << cap_string(new_caps) + << " (had " << cap_string(old_caps) << ")" << " for " << f->inode->ino() << " seq " << reply->get_file_caps_seq() << " from mds" << mds << endl; - int old_caps = f->inode->caps[mds].caps; f->inode->caps[mds].caps = new_caps; f->inode->caps[mds].seq = reply->get_file_caps_seq(); diff --git a/branches/sage/cephmds2/mds/Locker.cc b/branches/sage/cephmds2/mds/Locker.cc index 19d8545fb043e..475a323fcd80e 100644 --- a/branches/sage/cephmds2/mds/Locker.cc +++ b/branches/sage/cephmds2/mds/Locker.cc @@ -361,7 +361,9 @@ Capability* Locker::issue_new_caps(CInode *in, Capability c(my_want); in->add_client_cap(my_client, c); cap = in->get_client_cap(my_client); - + + // suppress file cap messages for new cap (we'll bundle with the open() reply) + cap->set_suppress(true); } else { // make sure it has sufficient caps if (cap->wanted() & ~my_want) { @@ -370,8 +372,6 @@ Capability* Locker::issue_new_caps(CInode *in, } } - // suppress file cap messages for this guy for a few moments (we'll bundle with the open() reply) - cap->set_suppress(true); int before = cap->pending(); if (in->is_auth()) { @@ -1747,7 +1747,7 @@ void Locker::file_eval(FileLock *lock) // * -> sync? else if (!in->filelock.is_waiter_for(SimpleLock::WAIT_WR) && - !(wanted & CAP_FILE_WR) && + !(wanted & (CAP_FILE_WR|CAP_FILE_WRBUFFER)) && ((wanted & CAP_FILE_RD) || in->is_replicated() || (!loner && lock->get_state() == LOCK_LONER)) && diff --git a/branches/sage/cephmds2/messages/MClientFileCaps.h b/branches/sage/cephmds2/messages/MClientFileCaps.h index 3688abac02854..8b1a88cd848f3 100644 --- a/branches/sage/cephmds2/messages/MClientFileCaps.h +++ b/branches/sage/cephmds2/messages/MClientFileCaps.h @@ -64,7 +64,15 @@ class MClientFileCaps : public Message { this->special = special; this->mds = mds; } + char *get_type_name() { return "Cfcap";} + void print(ostream& out) { + out << "client_file_caps(" << inode.ino + << " seq " << seq + << " caps " << cap_string(caps) + << " wanted" << cap_string(wanted) + << ")"; + } void decode_payload() { int off = 0; -- 2.39.5