]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: release the client_lock before copying data in read 36294/head
author00111048 <chen.can2@zte.com.cn>
Fri, 5 Jun 2020 06:46:06 +0000 (14:46 +0800)
committerRamana Raja <rraja@redhat.com>
Sun, 26 Jul 2020 19:08:30 +0000 (00:38 +0530)
Fixes: https://tracker.ceph.com/issues/46025
Signed-off-by: Chencan <chen.can2@zte.com.cn>
(cherry picked from commit db292da7d5571ed3addedfb4c5ab8c61fe9bb5e8)

Conflicts:
       src/client/Client.cc
- in nautilus, not switched bufferlist::copy() to iterators

src/client/Client.cc [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3a02b72..0901f71
@@ -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();
   }