}
fd_map.clear();
+ while (!opened_dirs.empty()) {
+ dir_result_t *dirp = *opened_dirs.begin();
+ ldout(cct, 1) << "tear_down_cache forcing close of dir " << dirp << " ino " << dirp->inode->ino << dendl;
+ _closedir(dirp);
+ }
+
// caps!
// *** FIXME ***
_release_fh(fh);
}
+ while (!opened_dirs.empty()) {
+ dir_result_t *dirp = *opened_dirs.begin();
+ ldout(cct, 0) << " destroyed lost open dir " << dirp << " on " << *dirp->inode << dendl;
+ _closedir(dirp);
+ }
+
_ll_drop_pins();
while (unsafe_sync_write > 0) {
if (!in->is_dir())
return -ENOTDIR;
*dirpp = new dir_result_t(in);
+ opened_dirs.insert(*dirpp);
if (in->dir) {
(*dirpp)->release_count = in->dir->release_count;
(*dirpp)->ordered_count = in->dir->ordered_count;
dirp->inode.reset();
}
_readdir_drop_dirp_buffer(dirp);
+ opened_dirs.erase(dirp);
delete dirp;
}
return r;
}
- int r = 0;
- if (vino.snapid == CEPH_SNAPDIR) {
- *dirpp = new dir_result_t(in);
- } else {
- r = _opendir(in, dirpp, uid, gid);
- }
-
+ int r = _opendir(in, dirpp, uid, gid);
tout(cct) << (unsigned long)*dirpp << std::endl;
ldout(cct, 3) << "ll_opendir " << vino << " = " << r << " (" << *dirpp << ")"
using std::map;
using std::fstream;
+#include "include/unordered_set.h"
#include "include/unordered_map.h"
#include "include/filepath.h"
// file handles, etc.
interval_set<int> free_fd_set; // unused fds
ceph::unordered_map<int, Fh*> fd_map;
+
+ ceph::unordered_set<dir_result_t*> opened_dirs;
int get_fd() {
int fd = free_fd_set.range_start();