From: Sage Weil Date: Wed, 17 Oct 2012 22:44:09 +0000 (-0700) Subject: client: release import caps we don't have X-Git-Tag: v0.55~236 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7d9ee17e82efbf7e09e1227df5fb25bc032a9ba2;p=ceph.git client: release import caps we don't have If we don't have the inode, release the caps. There is no point in adding it to our cache, and that is problematic anyway because it ends up with a ref count of zero and no dentry that will get trimmed by trim_cache(), leaving it stuck there on shutdown. This also aligns us with the kernel client behavior. Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 6eac729ca1ed..b83bfeb4c9ed 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2999,20 +2999,24 @@ void Client::handle_caps(MClientCaps *m) in = inode_map[vino]; if (!in) { if (m->get_op() == CEPH_CAP_OP_IMPORT) { - ldout(cct, 5) << "handle_caps adding ino " << vino << " on IMPORT" << dendl; - in = new Inode(cct, vino, &m->get_layout()); - inode_map[vino] = in; - in->ino = vino.ino; - in->snapid = vino.snapid; - in->mode = m->head.mode; + ldout(cct, 5) << "handle_caps don't have vino " << vino << " on IMPORT, immediately releasing" << dendl; + MetaSession *session = mds_sessions[mds]; + if (!session->release) + session->release = new MClientCapRelease; + ceph_mds_cap_item i; + i.ino = m->get_ino(); + i.cap_id = m->get_cap_id(); + i.seq = m->get_seq(); + i.migrate_seq = m->get_mseq(); + session->release->caps.push_back(i); } else { ldout(cct, 5) << "handle_caps don't have vino " << vino << ", dropping" << dendl; - m->put(); - - // in case the mds is waiting on e.g. a revocation - flush_cap_releases(); - return; } + m->put(); + + // in case the mds is waiting on e.g. a revocation + flush_cap_releases(); + return; } switch (m->get_op()) {