]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix shutdown with open inodes 10958/head
authorJohn Spray <john.spray@redhat.com>
Sun, 24 Jul 2016 16:19:55 +0000 (17:19 +0100)
committerYan, Zheng <zyan@redhat.com>
Fri, 2 Sep 2016 08:40:21 +0000 (16:40 +0800)
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 <john.spray@redhat.com>
(cherry picked from commit d642b4faec3266f609e4871ccdccdcd73707dc23)

src/client/Client.cc

index b465cadec55f2f337b6e74fce0b0d411f0cbe7b9..f8d13767ec29bc10e8b3d561921e2e8e608b4c5d 100644 (file)
@@ -5651,9 +5651,10 @@ void Client::unmount()
   
   while (!ll_unclosed_fh_set.empty()) {
     set<Fh*>::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()) {