Merge pull request #46267 from tshacked/fix_24894

client: allow overwrites to file with size greater than the max_file_size

Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
Venky Shankar 2022-06-07 22:44:01 +05:30 committed by GitHub
commit 37a466b475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10593,13 +10593,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;
}