summaryrefslogtreecommitdiff
path: root/fs/squashfs/block.c
diff options
context:
space:
mode:
authorVincent Whitchurch <vincent.whitchurch@axis.com>2021-06-28 19:33:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-06-29 10:53:46 -0700
commit10dde05b89980ef147f590d2735d7dd53aa39c88 (patch)
tree2724162f69cba85fc4ee0c2a13a9b087dd1d6d0a /fs/squashfs/block.c
parentd98e4d95411bbde2220a7afa38dcc9c14d71acbe (diff)
downloadlinux-rpi-10dde05b89980ef147f590d2735d7dd53aa39c88.tar.gz
linux-rpi-10dde05b89980ef147f590d2735d7dd53aa39c88.tar.bz2
linux-rpi-10dde05b89980ef147f590d2735d7dd53aa39c88.zip
squashfs: add option to panic on errors
Add an errors=panic mount option to make squashfs trigger a panic when errors are encountered, similar to several other filesystems. This allows a kernel dump to be saved using which the corruption can be analysed and debugged. Inspired by a pre-fs_context patch by Anton Eliasson. Link: https://lkml.kernel.org/r/20210527125019.14511-1-vincent.whitchurch@axis.com Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/squashfs/block.c')
-rw-r--r--fs/squashfs/block.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index b9e87ebb1060..855f0e87066d 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -226,8 +226,11 @@ out_free_bio:
bio_free_pages(bio);
bio_put(bio);
out:
- if (res < 0)
+ if (res < 0) {
ERROR("Failed to read block 0x%llx: %d\n", index, res);
+ if (msblk->panic_on_errors)
+ panic("squashfs read failed");
+ }
return res;
}