Merge PR #22512 into master

* refs/pull/22512/head:
	client: fix bug #24491 _ll_drop_pins may access invalid iterator

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Zheng Yan <zyan@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-06-15 07:05:36 -07:00
commit 8db4bedabd
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB

View File

@ -10472,6 +10472,7 @@ int Client::_ll_put(Inode *in, int num)
void Client::_ll_drop_pins()
{
ldout(cct, 10) << __func__ << dendl;
std::set<InodeRef> to_be_put; //this set will be deconstructed item by item when exit
ceph::unordered_map<vinodeno_t, Inode*>::iterator next;
for (ceph::unordered_map<vinodeno_t, Inode*>::iterator it = inode_map.begin();
it != inode_map.end();
@ -10479,8 +10480,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);
}
}
}