diff options
author | Richard Weinberger <richard@nod.at> | 2018-07-12 13:01:58 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-08-15 00:25:21 +0200 |
commit | 2e52eb74463f15c745d64948cedfaee722d6268c (patch) | |
tree | 28c0633e10d74d5e12ac3179108c1fed8c52e4f3 /fs/ubifs/debug.h | |
parent | 6eb61d587f4515e4be5669eff383c0185009954f (diff) | |
download | linux-2e52eb74463f15c745d64948cedfaee722d6268c.tar.gz linux-2e52eb74463f15c745d64948cedfaee722d6268c.tar.bz2 linux-2e52eb74463f15c745d64948cedfaee722d6268c.zip |
ubifs: Rework ubifs_assert()
With having access to struct ubifs_info in ubifs_assert() we can
give more information when an assert is failing.
By using ubifs_err() we can tell which UBIFS instance failed.
Also multiple actions can be taken now.
We support:
- report: This is what UBIFS did so far, just report the failure and go
on.
- read-only: Switch to read-only mode.
- panic: shoot the kernel in the head.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/debug.h')
-rw-r--r-- | fs/ubifs/debug.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 981a3fa081f3..64c6977c189b 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -148,18 +148,20 @@ struct ubifs_global_debug_info { unsigned int tst_rcvry:1; }; +void ubifs_assert_failed(struct ubifs_info *c, const char *expr, + const char *file, int line); + #define ubifs_assert(c, expr) do { \ if (unlikely(!(expr))) { \ - pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \ - __func__, __LINE__, current->pid); \ - dump_stack(); \ + ubifs_assert_failed((struct ubifs_info *)c, #expr, __FILE__, \ + __LINE__); \ } \ } while (0) #define ubifs_assert_cmt_locked(c) do { \ if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ up_write(&(c)->commit_sem); \ - pr_crit("commit lock is not locked!\n"); \ + ubifs_err(c, "commit lock is not locked!\n"); \ ubifs_assert(c, 0); \ } \ } while (0) |