]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
uClient: now cleans up open files on shutdown.
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 6 Aug 2009 22:28:00 +0000 (15:28 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 6 Aug 2009 22:28:00 +0000 (15:28 -0700)
Doesn't crash on a failed assert!

src/client/Client.cc

index 5fbcede2d886ed4bb35ed9a4a317b522dcb598ba..5aa44583b55e20e8b3d44e7cae731db6dec6c358 100644 (file)
@@ -2548,7 +2548,18 @@ int Client::unmount()
   cwd = 0;
 
   // NOTE: i'm assuming all caches are already flushing (because all files are closed).
-  assert(fd_map.empty());
+
+  //clean up any unclosed files
+  if (!fd_map.empty())
+    std::cerr << "Warning: Some files were not closed prior to unmounting;\n"
+             << "Ceph is closing them now.\n";
+  while (!fd_map.empty()) {
+    int fd = fd_map.begin()->first;
+    assert(fd_map.count(fd));
+    Fh *fh = fd_map[fd];
+    _release(fh);
+    fd_map.erase(fd);
+  }
 
   _ll_drop_pins();