]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
CollectionIndex: Collection name is added to the access_lock name 2283/head
authorSomnath Roy <somnath.roy@sandisk.com>
Mon, 18 Aug 2014 23:59:36 +0000 (16:59 -0700)
committerSomnath Roy <somnath.roy@sandisk.com>
Wed, 20 Aug 2014 01:50:01 +0000 (18:50 -0700)
The CollectionIndex constructor is changed to accept the coll_t
so that the collection name can be used to form access_lock(RWLock)
name.This is needed otherwise lockdep will report a recursive lock error
and assert. lockdep needs unique lock names for each Index object.

Fixes: #9145
Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
src/os/CollectionIndex.h
src/os/FlatIndex.h
src/os/LFNIndex.h

index d24d257325db2fb0c1a102b3b46771d5753f4a31..62df19e5297280ef17ba62242e4f3bc66db8098f 100644 (file)
@@ -73,6 +73,7 @@ protected:
   };
  public:
 
+  string access_lock_name;
   RWLock access_lock;
   /// Type of returned paths
   typedef ceph::shared_ptr<Path> IndexedPath;
@@ -180,7 +181,9 @@ protected:
   /// Call prior to removing directory
   virtual int prep_delete() { return 0; }
 
-  CollectionIndex():access_lock("CollectionIndex::access_lock"){}
+  CollectionIndex(coll_t collection):
+    access_lock_name ("CollectionIndex::access_lock::" + collection.to_str()), 
+    access_lock(access_lock_name.c_str()) {}
 
   /// Virtual destructor
   virtual ~CollectionIndex() {}
index ba6b5c2d236f32aeb49697094f5eb4d904ca375e..0509df46470f684c3d80495dfd1ec2811198524d 100644 (file)
@@ -32,8 +32,10 @@ class FlatIndex : public CollectionIndex {
   string base_path;
   coll_t collection;
 public:
-  FlatIndex(coll_t collection, string base_path) : base_path(base_path),
-                                                  collection(collection) {}
+  FlatIndex(coll_t collection, string base_path) : 
+              CollectionIndex(collection),
+              base_path(base_path),
+             collection(collection) {}
 
   /// @see CollectionIndex
   uint32_t collection_version() { return FLAT_INDEX_TAG; }
index dad6c39d688f6c70a50da40454cec3cf3055aa1b..d5024db091242034f95f989bee376ebb98bc3a4f 100644 (file)
@@ -131,7 +131,8 @@ public:
     const char *base_path, ///< [in] path to Index root
     uint32_t index_version,
     double _error_injection_probability=0)
-    : base_path(base_path),
+    : CollectionIndex(collection), 
+      base_path(base_path),
       index_version(index_version),
       error_injection_enabled(false),
       error_injection_on(_error_injection_probability != 0),