From a451a3670b7bb783ca6dcb8b2a31a8e6ec396899 Mon Sep 17 00:00:00 2001 From: Tamar Shacked Date: Sun, 15 May 2022 11:39:22 +0300 Subject: [PATCH] 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 --- src/client/Client.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 4d9c0dfe8e7..a9e05350ff4 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10577,13 +10577,14 @@ 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; - - if ((uint64_t)(offset+size) > mdsmap->get_max_filesize()) //too large! - return -CEPHFS_EFBIG; - - //ldout(cct, 7) << "write fh " << fh << " size " << size << " offset " << offset << dendl; Inode *in = f->inode.get(); + 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; + if (objecter->osdmap_pool_full(in->layout.pool_id)) { return -CEPHFS_ENOSPC; }