]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: allow overwrites to files with size greater than the max_file_size cfg 47971/head
authorTamar Shacked <tshacked@redhat.com>
Sun, 15 May 2022 08:39:22 +0000 (11:39 +0300)
committerVenky Shankar <vshankar@redhat.com>
Mon, 5 Sep 2022 09:10:05 +0000 (14:40 +0530)
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>
(cherry picked from commit a451a3670b7bb783ca6dcb8b2a31a8e6ec396899)

src/client/Client.cc

index e7f5b8b376b5b7e2705d852bd7e45c2e5b05ce45..2dc55a3eb8614b700e9f853f2827c8eff05b19b0 100644 (file)
@@ -10393,12 +10393,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;