From: 00111048 Date: Fri, 5 Jun 2020 06:46:06 +0000 (+0800) Subject: client: release the client_lock before copying data in read X-Git-Tag: v14.2.11~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F36294%2Fhead;p=ceph.git client: release the client_lock before copying data in read Fixes: https://tracker.ceph.com/issues/46025 Signed-off-by: Chencan (cherry picked from commit db292da7d5571ed3addedfb4c5ab8c61fe9bb5e8) Conflicts: src/client/Client.cc - in nautilus, not switched bufferlist::copy() to iterators --- diff --git a/src/client/Client.cc b/src/client/Client.cc old mode 100644 new mode 100755 index 3a02b72c2ba..0901f710e29 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -9074,7 +9074,7 @@ int Client::uninline_data(Inode *in, Context *onfinish) int Client::read(int fd, char *buf, loff_t size, loff_t offset) { - std::lock_guard lock(client_lock); + std::unique_lock lock(client_lock); tout(cct) << "read" << std::endl; tout(cct) << fd << std::endl; tout(cct) << size << std::endl; @@ -9096,6 +9096,7 @@ int Client::read(int fd, char *buf, loff_t size, loff_t offset) int r = _read(f, offset, size, &bl); ldout(cct, 3) << "read(" << fd << ", " << (void*)buf << ", " << size << ", " << offset << ") = " << r << dendl; if (r >= 0) { + lock.unlock(); bl.copy(0, bl.length(), buf); r = bl.length(); }