From d094c168aa0d9752ca2ffaf3d9569445c251ccc0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 22 Dec 2017 16:06:07 +0100 Subject: [PATCH] archive/{iso9660,zzip}: unlock the mutex during I/O Similar to commit 31ab78ae8e10af948ec95496df0d2abf1ea631a4 --- NEWS | 1 + src/archive/plugins/Iso9660ArchivePlugin.cxx | 2 ++ src/archive/plugins/ZzipArchivePlugin.cxx | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 394860cfc..9690c3202 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.20.14 (not yet released) - simple: fix file corruption in the presence of mount points * archive - bz2: fix deadlock + - reduce lock contention, fixing lots of xrun problems * fix Solaris build failure ver 0.20.13 (2017/12/18) diff --git a/src/archive/plugins/Iso9660ArchivePlugin.cxx b/src/archive/plugins/Iso9660ArchivePlugin.cxx index 9e4c4f16a..536745d85 100644 --- a/src/archive/plugins/Iso9660ArchivePlugin.cxx +++ b/src/archive/plugins/Iso9660ArchivePlugin.cxx @@ -182,6 +182,8 @@ Iso9660ArchiveFile::OpenStream(const char *pathname, size_t Iso9660InputStream::Read(void *ptr, size_t read_size) { + const ScopeUnlock unlock(mutex); + int readed = 0; int no_blocks, cur_block; size_t left_bytes = statbuf->size - offset; diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx index 5ba087f48..fc1e50b16 100644 --- a/src/archive/plugins/ZzipArchivePlugin.cxx +++ b/src/archive/plugins/ZzipArchivePlugin.cxx @@ -138,6 +138,8 @@ ZzipArchiveFile::OpenStream(const char *pathname, size_t ZzipInputStream::Read(void *ptr, size_t read_size) { + const ScopeUnlock unlock(mutex); + int ret = zzip_file_read(file, ptr, read_size); if (ret < 0) throw std::runtime_error("zzip_file_read() has failed"); @@ -155,6 +157,8 @@ ZzipInputStream::IsEOF() noexcept void ZzipInputStream::Seek(offset_type new_offset) { + const ScopeUnlock unlock(mutex); + zzip_off_t ofs = zzip_seek(file, new_offset, SEEK_SET); if (ofs < 0) throw std::runtime_error("zzip_seek() has failed");