diff --git a/trunk/ceph/client/Client.cc b/trunk/ceph/client/Client.cc index b9556623d63..2b85f1a7ad9 100644 --- a/trunk/ceph/client/Client.cc +++ b/trunk/ceph/client/Client.cc @@ -949,6 +949,7 @@ void Client::release_caps(Inode *in, dout(5) << "releasing caps on ino " << in->inode.ino << dec << " had " << cap_string(in->file_caps()) << " retaining " << cap_string(retain) + << " want " << cap_string(in->file_caps_wanted()) << endl; for (map::iterator it = in->caps.begin(); @@ -2119,13 +2120,15 @@ int Client::open(const char *relpath, int flags) void Client::close_release(Inode *in) { dout(10) << "close_release on " << in->ino() << endl; + dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd + << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << endl; if (!in->num_open_rd) in->fc.release_clean(); int retain = 0; - if (in->num_open_wr || in->fc.is_dirty()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER; - if (in->num_open_rd || in->fc.is_cached()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER; + if (in->num_open_wr || in->fc.is_dirty()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER | CAP_FILE_WREXTEND; + if (in->num_open_rd || in->fc.is_cached()) retain |= CAP_FILE_RD | CAP_FILE_RDCACHE; release_caps(in, retain); // release caps now. } diff --git a/trunk/ceph/client/FileCache.cc b/trunk/ceph/client/FileCache.cc index 36b28dc6003..5d572ab7b67 100644 --- a/trunk/ceph/client/FileCache.cc +++ b/trunk/ceph/client/FileCache.cc @@ -76,7 +76,7 @@ void FileCache::check_caps() // check callbacks map >::iterator p = caps_callbacks.begin(); while (p != caps_callbacks.end()) { - if (used == 0 || (~(p->first) & used)) { + if (used == 0 || (~(p->first) & used) == 0) { // implemented. dout(10) << "used is " << cap_string(used) << ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << endl;