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)
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;