From: Tamar Shacked Date: Sun, 15 May 2022 08:39:22 +0000 (+0300) Subject: client: allow overwrites to files with size greater than the max_file_size cfg X-Git-Tag: v16.2.11~325^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47972%2Fhead;p=ceph.git client: allow overwrites to files with size greater than the max_file_size cfg 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 (cherry picked from commit a451a3670b7bb783ca6dcb8b2a31a8e6ec396899) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index df5021af1712..7b92aecbf55b 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10416,12 +10416,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;