| .. | .. |
|---|
| 10 | 10 | #include <linux/slab.h> |
|---|
| 11 | 11 | #include <linux/percpu.h> |
|---|
| 12 | 12 | #include <linux/buffer_head.h> |
|---|
| 13 | +#include <linux/locallock.h> |
|---|
| 13 | 14 | |
|---|
| 14 | 15 | #include "squashfs_fs.h" |
|---|
| 15 | 16 | #include "squashfs_fs_sb.h" |
|---|
| .. | .. |
|---|
| 24 | 25 | struct squashfs_stream { |
|---|
| 25 | 26 | void *stream; |
|---|
| 26 | 27 | }; |
|---|
| 28 | + |
|---|
| 29 | +static DEFINE_LOCAL_IRQ_LOCK(stream_lock); |
|---|
| 27 | 30 | |
|---|
| 28 | 31 | void *squashfs_decompressor_create(struct squashfs_sb_info *msblk, |
|---|
| 29 | 32 | void *comp_opts) |
|---|
| .. | .. |
|---|
| 79 | 82 | { |
|---|
| 80 | 83 | struct squashfs_stream __percpu *percpu = |
|---|
| 81 | 84 | (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); |
|---|
| 86 | 94 | |
|---|
| 87 | 95 | if (res < 0) |
|---|
| 88 | 96 | ERROR("%s decompression failed, data probably corrupt\n", |
|---|