From 8220cac56e91e72c6884ae1596bd44be460e0d59 Mon Sep 17 00:00:00 2001 From: 00111048 Date: Fri, 5 Jun 2020 14:46:06 +0800 Subject: [PATCH] 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 --- src/client/Client.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/client/Client.cc diff --git a/src/client/Client.cc b/src/client/Client.cc old mode 100644 new mode 100755 index 3a02b72c2ba2..0901f710e291 --- 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(); } -- 2.47.3