]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common: OutputDataSocket retakes mutex on error path 29201/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 6 Jun 2019 13:48:42 +0000 (09:48 -0400)
committerNathan Cutler <ncutler@suse.com>
Tue, 23 Jul 2019 13:01:10 +0000 (15:01 +0200)
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)

Conflicts:
    src/common/OutputDataSocket.cc
- use Mutex::Locker instead of std::scoped_lock

src/common/OutputDataSocket.cc

index f2244cde84b82513c7d313ebfb278a1a1955022a..d17ae9022eff0f494c54c5da978f560fd50e2731 100644 (file)
@@ -302,6 +302,7 @@ int OutputDataSocket::dump_data(int fd)
       ret = safe_write(fd, delim.c_str(), delim.length());
     }
     if (ret < 0) {
+      Mutex::Locker lock(m_lock);
       for (; iter != l.end(); ++iter) {
         bufferlist& bl = *iter;
        data.push_back(bl);