From cf211d7dc2eef46cb409b425caa72aac1b24bd7c Mon Sep 17 00:00:00 2001 From: John Spray Date: Sun, 24 Jul 2016 17:19:55 +0100 Subject: [PATCH] client: fix shutdown with open inodes This piece of code was dereferencing an invalid iterator (invalidated by call to erase()) Fixes: http://tracker.ceph.com/issues/16764 Signed-off-by: John Spray (cherry picked from commit d642b4faec3266f609e4871ccdccdcd73707dc23) --- src/client/Client.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index b465cadec55f2..f8d13767ec29b 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5651,9 +5651,10 @@ void Client::unmount() while (!ll_unclosed_fh_set.empty()) { set::iterator it = ll_unclosed_fh_set.begin(); - ll_unclosed_fh_set.erase(*it); - ldout(cct, 0) << " destroyed lost open file " << *it << " on " << *((*it)->inode) << dendl; - _release_fh(*it); + Fh *fh = *it; + ll_unclosed_fh_set.erase(fh); + ldout(cct, 0) << " destroyed lost open file " << fh << " on " << *(fh->inode) << dendl; + _release_fh(fh); } while (!opened_dirs.empty()) { -- 2.39.5