mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
6eb61d587f
commit
2e52eb7446
3 changed files with 42 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue