From: Yan, Zheng Date: Wed, 20 Jan 2016 14:22:01 +0000 (+0800) Subject: client: properly trim unlinked inode X-Git-Tag: v10.0.3~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F7297%2Fhead;p=ceph.git client: properly trim unlinked inode Client should trim inode from its cache when receiving a cap message with nlink == 0. But the corresponding code has a bug, it does nothing when inode's nlink is already 0. Fixes: #13903 Signed-off-by: Yan, Zheng --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 5412e0c0190f..13c3233faf5c 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4658,7 +4658,7 @@ void Client::handle_cap_grant(MetaSession *session, Inode *in, Cap *cap, MClient in->gid = m->head.gid; } bool deleted_inode = false; - if ((issued & CEPH_CAP_LINK_EXCL) == 0 && in->nlink != (int32_t)m->head.nlink) { + if ((issued & CEPH_CAP_LINK_EXCL) == 0) { in->nlink = m->head.nlink; if (in->nlink == 0 && (new_caps & (CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL)))