]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: do not accept zero byte write request
authorDhairya Parmar <dparmar@redhat.com>
Thu, 7 Dec 2023 17:44:01 +0000 (23:14 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Tue, 30 Jan 2024 09:20:57 +0000 (14:50 +0530)
Fixes: https://tracker.ceph.com/issues/63734
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/client/Client.cc

index d8b6c32090e48fd9e3412e014735b79ca6a474d3..58a289d1a23a9f2546a2198ce38fd4e43147c30f 100644 (file)
@@ -11441,6 +11441,10 @@ int64_t Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf,
   CWF_iofinish *cwf_iofinish = NULL;
   C_SaferCond *cond_iofinish = NULL;
 
+  if (size < 1) { // zero bytes write is not supported by osd
+    return -CEPHFS_EINVAL;
+  }
+
   if ( (uint64_t)(offset+size) > mdsmap->get_max_filesize() && //exceeds config
        (uint64_t)(offset+size) > in->size ) { //exceeds filesize 
       return -CEPHFS_EFBIG;