]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: allow overwrites to files with size greater than the max_file_size cfg
authorTamar Shacked <tshacked@redhat.com>
Sun, 15 May 2022 08:39:22 +0000 (11:39 +0300)
committerTamar Shacked <tshacked@redhat.com>
Sun, 15 May 2022 08:44:05 +0000 (11:44 +0300)
Before this change, overwriting from file-offset >= max_file_size config
returns "File too large" (even though the data is being written)
This change allow overwrites as the file size is not further increasing.

Fixes: https://tracker.ceph.com/issues/24894
Signed-off-by: Tamar Shacked <tshacked@redhat.com>
src/client/Client.cc

index 4d9c0dfe8e79b955c372e530cedc169bae2a873c..a9e05350ff4c926dc967f0f1a911fe1ce3055de4 100644 (file)
@@ -10577,12 +10577,13 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf,
   ceph_assert(ceph_mutex_is_locked_by_me(client_lock));
 
   uint64_t fpos = 0;
+  Inode *in = f->inode.get();
 
-  if ((uint64_t)(offset+size) > mdsmap->get_max_filesize()) //too large!
-    return -CEPHFS_EFBIG;
-
+  if ( (uint64_t)(offset+size) > mdsmap->get_max_filesize() && //exceeds config
+       (uint64_t)(offset+size) > in->size ) { //exceeds filesize 
+      return -CEPHFS_EFBIG;              
+       }
   //ldout(cct, 7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
-  Inode *in = f->inode.get();
 
   if (objecter->osdmap_pool_full(in->layout.pool_id)) {
     return -CEPHFS_ENOSPC;