From: Somnath Roy Date: Mon, 18 Aug 2014 23:59:36 +0000 (-0700) Subject: CollectionIndex: Collection name is added to the access_lock name X-Git-Tag: v0.85~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=97b1916ec4bb3bcc50de04b005c2544586d09bb5;p=ceph.git CollectionIndex: Collection name is added to the access_lock name 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 (cherry picked from commit 615d2d904024526cc58557ee5250c2536a3cd5c8) --- diff --git a/src/os/CollectionIndex.h b/src/os/CollectionIndex.h index d24d257325db..62df19e52972 100644 --- a/src/os/CollectionIndex.h +++ b/src/os/CollectionIndex.h @@ -73,6 +73,7 @@ protected: }; public: + string access_lock_name; RWLock access_lock; /// Type of returned paths typedef ceph::shared_ptr 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() {} diff --git a/src/os/FlatIndex.h b/src/os/FlatIndex.h index ba6b5c2d236f..0509df46470f 100644 --- a/src/os/FlatIndex.h +++ b/src/os/FlatIndex.h @@ -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; } diff --git a/src/os/LFNIndex.h b/src/os/LFNIndex.h index dad6c39d688f..d5024db09124 100644 --- a/src/os/LFNIndex.h +++ b/src/os/LFNIndex.h @@ -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),