From: Christopher Hoffman Date: Tue, 4 Feb 2025 18:31:28 +0000 (+0000) Subject: client: Calculate len before prepare_data_read X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f72a0070dbc38b82b0b3d201229e57c71f973b08;p=ceph-ci.git client: Calculate len before prepare_data_read Fixes: https://tracker.ceph.com/issues/69797 Signed-off-by: Christopher Hoffman --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 0f88cded8d4..b72c6b3c621 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -11717,6 +11717,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, @@ -11727,7 +11732,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, @@ -11757,10 +11761,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()