hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/fs/squashfs/decompressor_multi_percpu.c
....@@ -10,6 +10,7 @@
1010 #include <linux/slab.h>
1111 #include <linux/percpu.h>
1212 #include <linux/buffer_head.h>
13
+#include <linux/locallock.h>
1314
1415 #include "squashfs_fs.h"
1516 #include "squashfs_fs_sb.h"
....@@ -24,6 +25,8 @@
2425 struct squashfs_stream {
2526 void *stream;
2627 };
28
+
29
+static DEFINE_LOCAL_IRQ_LOCK(stream_lock);
2730
2831 void *squashfs_decompressor_create(struct squashfs_sb_info *msblk,
2932 void *comp_opts)
....@@ -79,10 +82,15 @@
7982 {
8083 struct squashfs_stream __percpu *percpu =
8184 (struct squashfs_stream __percpu *) msblk->stream;
82
- struct squashfs_stream *stream = get_cpu_ptr(percpu);
83
- int res = msblk->decompressor->decompress(msblk, stream->stream, bh, b,
84
- offset, length, output);
85
- put_cpu_ptr(stream);
85
+ struct squashfs_stream *stream;
86
+ int res;
87
+
88
+ stream = get_locked_ptr(stream_lock, percpu);
89
+
90
+ res = msblk->decompressor->decompress(msblk, stream->stream, bh, b,
91
+ offset, length, output);
92
+
93
+ put_locked_ptr(stream_lock, stream);
8694
8795 if (res < 0)
8896 ERROR("%s decompression failed, data probably corrupt\n",