]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: check per-pool full flag in op path
authorJohn Spray <john.spray@redhat.com>
Tue, 31 Mar 2015 13:15:40 +0000 (14:15 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 12 May 2015 09:20:43 +0000 (10:20 +0100)
...so that in a quota full state, we give ENOSPC
up front instead of waiting for it to happen
on flush.

Fixes: #11276
Signed-off-by: John Spray <john.spray@redhat.com>
src/client/Client.cc

index c9b3c8909a0e11bb7dbfbe09e8423002c8fc4420..a9004a57c10f38e121235015a5f87626a300a804 100644 (file)
@@ -3329,7 +3329,7 @@ bool Client::_flush(Inode *in, Context *onfinish)
     return true;
   }
 
-  if (objecter->osdmap_full_flag()) {
+  if (objecter->osdmap_pool_full(in->layout.fl_pg_pool)) {
     ldout(cct, 1) << __func__ << ": FULL, purging for ENOSPC" << dendl;
     objectcacher->purge_set(&in->oset);
     if (onfinish) {
@@ -7353,13 +7353,13 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf)
   if ((uint64_t)(offset+size) > mdsmap->get_max_filesize()) //too large!
     return -EFBIG;
 
-  if (objecter->osdmap_full_flag()) {
-    return -ENOSPC;
-  }
-
   //ldout(cct, 7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
   Inode *in = f->inode;
 
+  if (objecter->osdmap_pool_full(in->layout.fl_pg_pool)) {
+    return -ENOSPC;
+  }
+
   assert(in->snapid == CEPH_NOSNAP);
 
   // was Fh opened as writeable?
@@ -10125,11 +10125,13 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
   if ((mode & FALLOC_FL_PUNCH_HOLE) && !(mode & FALLOC_FL_KEEP_SIZE))
     return -EOPNOTSUPP;
 
-  if (objecter->osdmap_full_flag() && !(mode & FALLOC_FL_PUNCH_HOLE))
-    return -ENOSPC;
-
   Inode *in = fh->inode;
 
+  if (objecter->osdmap_pool_full(in->layout.fl_pg_pool)
+      && !(mode & FALLOC_FL_PUNCH_HOLE)) {
+    return -ENOSPC;
+  }
+
   if (in->snapid != CEPH_NOSNAP)
     return -EROFS;