]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: OutputDataSocket retakes mutex on error path 29147/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 6 Jun 2019 13:48:42 +0000 (09:48 -0400)
committerPrashant D <pdhange@redhat.com>
Sun, 21 Jul 2019 23:06:49 +0000 (19:06 -0400)
the list of buffers is protected by mutex m_lock. when dump_data() fails
and puts unwritten buffers back into the list, it needs to reaquire the
lock

Fixes: http://tracker.ceph.com/issues/40188
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 8645e24dd4fb3ecc9f02b34a1be916620b5f71b1)

src/common/OutputDataSocket.cc

index daba820cf05a3b2a4f26e348dcc307238d35e79a..2603b552696b6534b2e19ac312ad42780594bc44 100644 (file)
@@ -303,6 +303,7 @@ int OutputDataSocket::dump_data(int fd)
       ret = safe_write(fd, delim.c_str(), delim.length());
     }
     if (ret < 0) {
+      std::scoped_lock lock(m_lock);
       for (; iter != l.end(); ++iter) {
         bufferlist& bl = *iter;
        data.push_back(bl);