]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Check for full before changing the cached obc 6918/head
authorAlexey Sheplyakov <asheplyakov@mirantis.com>
Wed, 16 Dec 2015 12:31:52 +0000 (15:31 +0300)
committerAlexey Sheplyakov <asheplyakov@mirantis.com>
Sat, 30 Jan 2016 09:13:50 +0000 (12:13 +0300)
ReplicatedPG::prepare_transaction(): check if the pool is full before
updating the cached ObjectContext to avoid the discrepancy between
the cached and the actual object size (and other metadata).
While at it improve the check itself: consider cluster full flag,
not just the pool full flag, also consider object count changes too,
not just bytes.

Based on commit a1eb380c3d5254f9f1fe34b4629e51d77fe010c1

Fixes: #13335
Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
src/osd/ReplicatedPG.cc

index 835fc2fceb22ffc834a50230cd2f8d42a8769d5e..fb701c484e466c1899a7ef195df5afb07c0c3c9e 100644 (file)
@@ -2288,10 +2288,8 @@ void ReplicatedPG::execute_ctx(OpContext *ctx)
     return;
   }
 
-  // check for full
-  if (ctx->delta_stats.num_bytes > 0 &&
-      pool.info.has_flag(pg_pool_t::FLAG_FULL)) {
-    reply_ctx(ctx, -ENOSPC);
+  if (result == -ENOSPC) {
+    reply_ctx(ctx, result);
     return;
   }
 
@@ -5674,6 +5672,15 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
     return result;
   }
 
+  // check for full
+  if ((ctx->delta_stats.num_bytes > 0 ||
+       ctx->delta_stats.num_objects > 0) &&
+      (pool.info.has_flag(pg_pool_t::FLAG_FULL) ||
+       get_osdmap()->test_flag(CEPH_OSDMAP_FULL))) {
+    dout(20) << __func__ << ": full, returning -ENOSPC" << dendl;
+    return -ENOSPC;
+  }
+
   // clone, if necessary
   if (soid.snap == CEPH_NOSNAP)
     make_writeable(ctx);