]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: return EOPNOTSUPP for fallocate with mode 0
authorMilind Changire <mchangir@redhat.com>
Wed, 11 Sep 2024 10:09:21 +0000 (15:39 +0530)
committerMilind Changire <mchangir@redhat.com>
Wed, 30 Oct 2024 10:11:11 +0000 (15:41 +0530)
Fixes: https://tracker.ceph.com/issues/68026
Signed-off-by: Milind Changire <mchangir@redhat.com>
src/client/Client.cc
src/pybind/cephfs/cephfs.pyx

index f687264e167bc797a9e4baef392cc60ec403c3b5..21555d0d07c8ec69240f139f083b760285e746c4 100644 (file)
@@ -16234,7 +16234,7 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
   if (offset < 0 || length <= 0)
     return -CEPHFS_EINVAL;
 
-  if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
+  if (mode == 0 || (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)))
     return -CEPHFS_EOPNOTSUPP;
 
   if ((mode & FALLOC_FL_PUNCH_HOLE) && !(mode & FALLOC_FL_KEEP_SIZE))
index 793d88b985013770442013ea91ee0fc576f356a9..798ea3f902a1a7ac9b8e2628c6e4bcdba9217098 100644 (file)
@@ -923,12 +923,12 @@ cdef class LibCephFS(object):
 
         :param fd: the file descriptor of the file to fallocate.
         :param mode: the flags determines the operation to be performed on the given
-                     range. default operation (0) allocate and initialize to zero
-                     the file in the byte range, and the file size will be changed
-                     if offset + length is greater than the file size. if the
-                     FALLOC_FL_KEEP_SIZE flag is specified in the mode, the file size
-                     will not be changed. if the FALLOC_FL_PUNCH_HOLE flag is specified
-                     in the mode, the operation is deallocate space and zero the byte range.
+                     range. default operation (0) is to return -EOPNOTSUPP since
+                     cephfs does not allocate disk blocks to provide write guarantees.
+                     if the FALLOC_FL_KEEP_SIZE flag is specified in the mode,
+                     the file size will not be changed.  if the FALLOC_FL_PUNCH_HOLE
+                     flag is specified in the mode, the operation is deallocate
+                     space and zero the byte range.
         :param offset: the byte range starting.
         :param length: the length of the range.
         """