From 360834b652107c483aee1edfd760353075f6a7cb Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 6 Aug 2009 15:28:00 -0700 Subject: [PATCH] uClient: now cleans up open files on shutdown. Doesn't crash on a failed assert! --- src/client/Client.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 5fbcede2d886e..5aa44583b55e2 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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(); -- 2.39.5