Skip to content

Commit 98a67b6

Browse files
committed
client: return EOPNOTSUPP for fallocate with mode 0
Fixes: https://tracker.ceph.com/issues/68026 Signed-off-by: Milind Changire <[email protected]>
1 parent 9c4fc78 commit 98a67b6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/client/Client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16234,7 +16234,7 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
1623416234
if (offset < 0 || length <= 0)
1623516235
return -CEPHFS_EINVAL;
1623616236

16237-
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
16237+
if (mode == 0 || (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)))
1623816238
return -CEPHFS_EOPNOTSUPP;
1623916239

1624016240
if ((mode & FALLOC_FL_PUNCH_HOLE) && !(mode & FALLOC_FL_KEEP_SIZE))

src/pybind/cephfs/cephfs.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,12 +923,12 @@ cdef class LibCephFS(object):
923923
924924
:param fd: the file descriptor of the file to fallocate.
925925
:param mode: the flags determines the operation to be performed on the given
926-
range. default operation (0) allocate and initialize to zero
927-
the file in the byte range, and the file size will be changed
928-
if offset + length is greater than the file size. if the
929-
FALLOC_FL_KEEP_SIZE flag is specified in the mode, the file size
930-
will not be changed. if the FALLOC_FL_PUNCH_HOLE flag is specified
931-
in the mode, the operation is deallocate space and zero the byte range.
926+
range. default operation (0) is to return -EOPNOTSUPP since
927+
cephfs does not allocate disk blocks to provide write guarantees.
928+
if the FALLOC_FL_KEEP_SIZE flag is specified in the mode,
929+
the file size will not be changed. if the FALLOC_FL_PUNCH_HOLE
930+
flag is specified in the mode, the operation is deallocate
931+
space and zero the byte range.
932932
:param offset: the byte range starting.
933933
:param length: the length of the range.
934934
"""

0 commit comments

Comments
 (0)