From: LiuYangkuan Date: Mon, 11 Jun 2018 15:51:16 +0000 (-0400) Subject: client: fix bug #24491 _ll_drop_pins may access invalid iterator X-Git-Tag: v14.0.1~1103^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=97188fef8596f098aa43aa745a217b40a6c29ea4;p=ceph.git client: fix bug #24491 _ll_drop_pins may access invalid iterator Fixes: https://tracker.ceph.com/issues/24491 Signed-off-by: Liu Yangkuan --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 213b78465d4f..f4bfb7177fa9 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10455,6 +10455,7 @@ int Client::_ll_put(Inode *in, int num) void Client::_ll_drop_pins() { ldout(cct, 10) << __func__ << dendl; + std::set to_be_put; //this set will be deconstructed item by item when exit ceph::unordered_map::iterator next; for (ceph::unordered_map::iterator it = inode_map.begin(); it != inode_map.end(); @@ -10462,8 +10463,10 @@ void Client::_ll_drop_pins() Inode *in = it->second; next = it; ++next; - if (in->ll_ref) + if (in->ll_ref){ + to_be_put.insert(in); _ll_put(in, in->ll_ref); + } } }