Project

General

Profile

Actions

Tasks #69797

closed

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

Tasks #69796: general libcephfs unit tests fail

OpenReadWrite

Added by Christopher Hoffman about 1 year ago. Updated about 1 year ago.

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

0%

Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

[ RUN      ] LibCephFS.OpenReadWrite
/cephfs/ceph/src/test/libcephfs/test.cc:151: Failure
Expected equality of these values:
  ceph_read(cmount, fd, in_buf, sizeof(in_buf), 0)
    Which is: 100
  (int)size
    Which is: 11
[  FAILED  ] LibCephFS.OpenReadWrite (1898 ms)
Actions #1

Updated by Christopher Hoffman about 1 year ago

  • Status changed from New to In Progress
  • Assignee set to Christopher Hoffman
Actions #2

Updated by Christopher Hoffman about 1 year ago

  • Status changed from In Progress to Resolved
Author: Christopher Hoffman <[email protected]>
Date:   Tue Feb 4 18:31:28 2025 +0000

    client: Calculate len before prepare_data_read

    Fixes: https://tracker.ceph.com/issues/69797
    Signed-off-by: Christopher Hoffman <[email protected]>

diff --git a/src/client/Client.cc b/src/client/Client.cc
index aa33b766779..af8feef7d1f 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -11486,6 +11486,11 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl,
   uint64_t read_start;
   uint64_t read_len;

+  auto effective_size = in->effective_size();
+  if (off + len > effective_size) {
+    len = effective_size - off;
+  }
+
   FSCryptFDataDencRef fscrypt_denc;
   fscrypt->prepare_data_read(in->fscrypt_ctx,
                              &in->fscrypt_key_validator,
@@ -11496,7 +11501,6 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl,
   // get Fc cap ref before commencing read
   get_cap_ref(in, CEPH_CAP_FILE_CACHE);

-  auto effective_size = in->effective_size();
   if (onfinish != nullptr) {
     io_finish.reset(new C_Read_Async_Finisher(this, onfinish, f, in, bl,
                                               f->pos, off, len,
@@ -11526,10 +11530,6 @@ int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl,
     return 0;
   }

-  if (off + len > effective_size) {
-    len = effective_size - off;
-  }
-
   auto target_len = std::min(len, effective_size - off);

   ldout(cct, 10) << " min_bytes=" << f->readahead.get_min_readahead_size()
Actions

Also available in: Atom PDF