]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore::lfn_open: don't call get_index under fdcache_lock
authorSamuel Just <sam.just@inktank.com>
Tue, 18 Jun 2013 20:11:45 +0000 (13:11 -0700)
committerSamuel Just <sam.just@inktank.com>
Tue, 18 Jun 2013 20:20:37 +0000 (13:20 -0700)
lfn_open() is called with indexes locked, so we cannot lock
and index under fdcache_lock.

Fixes: #5389
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/os/FileStore.cc

index 4218f695bc347d1d969b95900cd174058d3b74bf..4b6234e09035a72732aeb1dbd4fb4029c53e850e 100644 (file)
@@ -207,23 +207,23 @@ int FileStore::lfn_open(coll_t cid,
   int flags = O_RDWR;
   if (create)
     flags |= O_CREAT;
+  Index index2;
+  if (!index) {
+    index = &index2;
+  }
+  int r = 0;
+  if (!(*index)) {
+    r = get_index(cid, index);
+  }
   Mutex::Locker l(fdcache_lock);
   *outfd = fdcache.lookup(oid);
   if (*outfd) {
     return 0;
   }
-  Index index2;
   IndexedPath path2;
   if (!path)
     path = &path2;
   int fd, exist;
-  int r = 0;
-  if (!index) {
-    index = &index2;
-  }
-  if (!(*index)) {
-    r = get_index(cid, index);
-  }
   if (r < 0) {
     derr << "error getting collection index for " << cid
         << ": " << cpp_strerror(-r) << dendl;