summaryrefslogtreecommitdiffstats
path: root/src/kernel/xloop_file_fmt_qcow_main.h
diff options
context:
space:
mode:
authorSimon Rettberg2022-02-09 15:11:40 +0100
committerSimon Rettberg2022-03-04 12:04:14 +0100
commit08745f8292deffbdcbdb7071cebade5945fb924a (patch)
treef2864eea407de1374ef90f4269b9aaa0150ead60 /src/kernel/xloop_file_fmt_qcow_main.h
parentAdd more sanity checks to kernel_read calls and compressed buffer access (diff)
downloadxloop-08745f8292deffbdcbdb7071cebade5945fb924a.tar.gz
xloop-08745f8292deffbdcbdb7071cebade5945fb924a.tar.xz
xloop-08745f8292deffbdcbdb7071cebade5945fb924a.zip
qcow2: Add lock for lookup cache and decompression
Race conditions can occur if reads are submitted from different cgroups, as each cgroup has its own workqueue. Linearize the according parts of the code using a mutex, as this will in the worst case lead to performance on par with pre-5.15 versions of xloop, which used one workqueue for all cgroups.
Diffstat (limited to 'src/kernel/xloop_file_fmt_qcow_main.h')
-rw-r--r--src/kernel/xloop_file_fmt_qcow_main.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/kernel/xloop_file_fmt_qcow_main.h b/src/kernel/xloop_file_fmt_qcow_main.h
index aff5e13..32e14f9 100644
--- a/src/kernel/xloop_file_fmt_qcow_main.h
+++ b/src/kernel/xloop_file_fmt_qcow_main.h
@@ -291,6 +291,8 @@ struct xloop_file_fmt_qcow_data {
u64 compatible_features;
u64 autoclear_features;
+ struct mutex global_mutex;
+
/* ZLIB specific data */
z_streamp zlib_dstrm;