From: Xiubo Li Date: Thu, 14 Jul 2022 01:15:43 +0000 (+0800) Subject: client: do not uninline data for read X-Git-Tag: v16.2.11~82^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddb46e81eb2ace6de35da8588efc6755ed99727b;p=ceph.git client: do not uninline data for read We don't even ask for and to be sure that we have granted the Fw caps when reading, we shouldn't write contents to Rados. The bug was introduced by commit a0cb52425147 (client: Read inline data path) Fixes: https://tracker.ceph.com/issues/56553 Signed-off-by: Xiubo Li (cherry picked from commit 9bb335fdb22637e158a0badf2f2074b0952c0aa3) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index df5021af1712..93ec309df018 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -10017,7 +10017,6 @@ int64_t Client::_read(Fh *f, int64_t offset, uint64_t size, bufferlist *bl) int want, have = 0; bool movepos = false; - std::unique_ptr onuninline; int64_t rc = 0; const auto& conf = cct->_conf; Inode *in = f->inode.get(); @@ -10060,31 +10059,26 @@ retry: have &= ~(CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO); if (in->inline_version < CEPH_INLINE_NONE) { - if (!(have & CEPH_CAP_FILE_CACHE)) { - onuninline.reset(new C_SaferCond("Client::_read_uninline_data flock")); - uninline_data(in, onuninline.get()); - } else { - uint32_t len = in->inline_data.length(); - uint64_t endoff = offset + size; - if (endoff > in->size) - endoff = in->size; - - if (offset < len) { - if (endoff <= len) { - bl->substr_of(in->inline_data, offset, endoff - offset); - } else { - bl->substr_of(in->inline_data, offset, len - offset); - bl->append_zero(endoff - len); - } - rc = endoff - offset; - } else if ((uint64_t)offset < endoff) { - bl->append_zero(endoff - offset); - rc = endoff - offset; + uint32_t len = in->inline_data.length(); + uint64_t endoff = offset + size; + if (endoff > in->size) + endoff = in->size; + + if (offset < len) { + if (endoff <= len) { + bl->substr_of(in->inline_data, offset, endoff - offset); } else { - rc = 0; + bl->substr_of(in->inline_data, offset, len - offset); + bl->append_zero(endoff - len); } - goto success; + rc = endoff - offset; + } else if ((uint64_t)offset < endoff) { + bl->append_zero(endoff - offset); + rc = endoff - offset; + } else { + rc = 0; } + goto success; } if (!conf->client_debug_force_sync_read && @@ -10140,19 +10134,6 @@ success: done: // done! - - if (onuninline) { - client_lock.unlock(); - int ret = onuninline->wait(); - client_lock.lock(); - if (ret >= 0 || ret == -CEPHFS_ECANCELED) { - in->inline_data.clear(); - in->inline_version = CEPH_INLINE_NONE; - in->mark_caps_dirty(CEPH_CAP_FILE_WR); - check_caps(in, 0); - } else - rc = ret; - } if (have) { put_cap_ref(in, CEPH_CAP_FILE_RD); }