Project

General

Profile

Actions

Tasks #65745

closed

Tasks #63293: Implement fscrypt in libcephfs and cephfs-fuse

Tasks #64133: Make pjd work on fscrypt

RMW fail when on end of block or file

Added by Christopher Hoffman 17 days ago. Updated 17 days ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Tags:
Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:

Description

A RMW will fail when at end boundary of block or file.

See:

need_read_end = (endoff < in->effective_size() && ofs_in_end_block < FSCRYPT_BLOCK_SIZE - 1 && start_block != end_block);

Actions #1

Updated by Christopher Hoffman 17 days ago

  • Status changed from In Progress to Resolved
Author: Christopher Hoffman <choffman@redhat.com>
Date:   Wed May 1 17:36:00 2024 +0000

    client: fscrypt rmw fails when endoff end of block or file

    Fscrypt rmw fails when end of a write lines up with end of
    a block or end of the file.

    Fixes: https://tracker.ceph.com/issues/65745
    Signed-off-by: Christopher Hoffman <choffman@redhat.com>

diff --git a/src/client/Client.cc b/src/client/Client.cc
index 72a01ec902f..de83d76ecc4 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -11833,7 +11833,7 @@ int Client::WriteEncMgr::read_modify_write(Context *_iofinish)
                 << " end_block_ofs=" << end_block_ofs << " ofs_in_end_block=" << ofs_in_end_block
                 << dendl;
   need_read_start = (ofs_in_start_block >= 0 && (endoff - offset) <= FSCRYPT_BLOCK_SIZE);
-  need_read_end = (endoff < in->effective_size() && ofs_in_end_block < FSCRYPT_BLOCK_SIZE - 1 && start_block != end_block);
+  need_read_end = (endoff <= in->effective_size() && ofs_in_end_block < FSCRYPT_BLOCK_SIZE && start_block != end_block);
   read_start_size = FSCRYPT_BLOCK_SIZE;

   bool need_read = need_read_start | need_read_end;

Actions

Also available in: Atom PDF