summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/database_holder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/catalog/database_holder.cpp')
-rw-r--r--src/mongo/db/catalog/database_holder.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/catalog/database_holder.cpp b/src/mongo/db/catalog/database_holder.cpp
index 1978c395600..67d9282a894 100644
--- a/src/mongo/db/catalog/database_holder.cpp
+++ b/src/mongo/db/catalog/database_holder.cpp
@@ -38,14 +38,23 @@
#include "mongo/db/d_concurrency.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/mmap_v1/dur.h"
+#include "mongo/util/file_allocator.h"
+
namespace mongo {
- Database* DatabaseHolder::getOrCreate(OperationContext* txn, const string& ns, const string& path, bool& justCreated) {
- string dbname = _todb( ns );
+ Database* DatabaseHolder::getOrCreate(
+ OperationContext* txn, const string& ns, const string& path, bool& justCreated) {
+
+ const string dbname = _todb( ns );
+ invariant(txn->lockState()->isAtLeastReadLocked(dbname));
+
+ if (txn->lockState()->hasAnyWriteLock() && FileAllocator::get()->hasFailed()) {
+ uassert(17507, "Can't take a write lock while out of disk space", false);
+ }
+
{
SimpleMutex::scoped_lock lk(_m);
- Lock::assertAtLeastReadLocked(ns);
DBs& m = _paths[path];
{
DBs::iterator i = m.find(dbname);