aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2011-06-01 08:23:25 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-07-04 03:54:30 -0400
commit24a4f8009ee9e259a412d86373e0d2aac3a80333 (patch)
tree4ec4d21471e6fe770d3300ae41f1ca4a142b6b77 /fs/ubifs
parent81e79d38df5a17bb1c738a14f8e5f3412fb33afa (diff)
UBIFS: be more informative in failure mode
When we are testing UBIFS recovery, it is better to print in which eraseblock we are going to fail. Currently UBIFS prints it only if recovery debugging messages are enabled, but this is not very practical. So change 'dbg_rcvry()' messages to 'ubifs_warn()' messages. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/debug.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index fdfa5dea5b95..e4a3630eb520 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -2631,11 +2631,11 @@ static int do_fail(struct ubi_volume_desc *desc, int lnum, int write)
2631 d->fail_delay = 1; 2631 d->fail_delay = 1;
2632 d->fail_timeout = jiffies + 2632 d->fail_timeout = jiffies +
2633 msecs_to_jiffies(delay); 2633 msecs_to_jiffies(delay);
2634 dbg_rcvry("failing after %ums", delay); 2634 ubifs_warn("failing after %ums", delay);
2635 } else { 2635 } else {
2636 d->fail_delay = 2; 2636 d->fail_delay = 2;
2637 d->fail_cnt_max = delay; 2637 d->fail_cnt_max = delay;
2638 dbg_rcvry("failing after %u calls", delay); 2638 ubifs_warn("failing after %u calls", delay);
2639 } 2639 }
2640 } 2640 }
2641 d->fail_cnt += 1; 2641 d->fail_cnt += 1;
@@ -2653,56 +2653,56 @@ static int do_fail(struct ubi_volume_desc *desc, int lnum, int write)
2653 return 0; 2653 return 0;
2654 } else if (chance(19, 20)) 2654 } else if (chance(19, 20))
2655 return 0; 2655 return 0;
2656 dbg_rcvry("failing in super block LEB %d", lnum); 2656 ubifs_warn("failing in super block LEB %d", lnum);
2657 } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) { 2657 } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) {
2658 if (chance(19, 20)) 2658 if (chance(19, 20))
2659 return 0; 2659 return 0;
2660 dbg_rcvry("failing in master LEB %d", lnum); 2660 ubifs_warn("failing in master LEB %d", lnum);
2661 } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) { 2661 } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) {
2662 if (write) { 2662 if (write) {
2663 if (chance(99, 100)) 2663 if (chance(99, 100))
2664 return 0; 2664 return 0;
2665 } else if (chance(399, 400)) 2665 } else if (chance(399, 400))
2666 return 0; 2666 return 0;
2667 dbg_rcvry("failing in log LEB %d", lnum); 2667 ubifs_warn("failing in log LEB %d", lnum);
2668 } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) { 2668 } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) {
2669 if (write) { 2669 if (write) {
2670 if (chance(7, 8)) 2670 if (chance(7, 8))
2671 return 0; 2671 return 0;
2672 } else if (chance(19, 20)) 2672 } else if (chance(19, 20))
2673 return 0; 2673 return 0;
2674 dbg_rcvry("failing in LPT LEB %d", lnum); 2674 ubifs_warn("failing in LPT LEB %d", lnum);
2675 } else if (lnum >= c->orph_first && lnum <= c->orph_last) { 2675 } else if (lnum >= c->orph_first && lnum <= c->orph_last) {
2676 if (write) { 2676 if (write) {
2677 if (chance(1, 2)) 2677 if (chance(1, 2))
2678 return 0; 2678 return 0;
2679 } else if (chance(9, 10)) 2679 } else if (chance(9, 10))
2680 return 0; 2680 return 0;
2681 dbg_rcvry("failing in orphan LEB %d", lnum); 2681 ubifs_warn("failing in orphan LEB %d", lnum);
2682 } else if (lnum == c->ihead_lnum) { 2682 } else if (lnum == c->ihead_lnum) {
2683 if (chance(99, 100)) 2683 if (chance(99, 100))
2684 return 0; 2684 return 0;
2685 dbg_rcvry("failing in index head LEB %d", lnum); 2685 ubifs_warn("failing in index head LEB %d", lnum);
2686 } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) { 2686 } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) {
2687 if (chance(9, 10)) 2687 if (chance(9, 10))
2688 return 0; 2688 return 0;
2689 dbg_rcvry("failing in GC head LEB %d", lnum); 2689 ubifs_warn("failing in GC head LEB %d", lnum);
2690 } else if (write && !RB_EMPTY_ROOT(&c->buds) && 2690 } else if (write && !RB_EMPTY_ROOT(&c->buds) &&
2691 !ubifs_search_bud(c, lnum)) { 2691 !ubifs_search_bud(c, lnum)) {
2692 if (chance(19, 20)) 2692 if (chance(19, 20))
2693 return 0; 2693 return 0;
2694 dbg_rcvry("failing in non-bud LEB %d", lnum); 2694 ubifs_warn("failing in non-bud LEB %d", lnum);
2695 } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND || 2695 } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND ||
2696 c->cmt_state == COMMIT_RUNNING_REQUIRED) { 2696 c->cmt_state == COMMIT_RUNNING_REQUIRED) {
2697 if (chance(999, 1000)) 2697 if (chance(999, 1000))
2698 return 0; 2698 return 0;
2699 dbg_rcvry("failing in bud LEB %d commit running", lnum); 2699 ubifs_warn("failing in bud LEB %d commit running", lnum);
2700 } else { 2700 } else {
2701 if (chance(9999, 10000)) 2701 if (chance(9999, 10000))
2702 return 0; 2702 return 0;
2703 dbg_rcvry("failing in bud LEB %d commit not running", lnum); 2703 ubifs_warn("failing in bud LEB %d commit not running", lnum);
2704 } 2704 }
2705 ubifs_err("*** SETTING FAILURE MODE ON (LEB %d) ***", lnum); 2705
2706 d->failure_mode = 1; 2706 d->failure_mode = 1;
2707 dump_stack(); 2707 dump_stack();
2708 return 1; 2708 return 1;
@@ -2922,8 +2922,16 @@ static ssize_t dfs_file_write(struct file *file, const char __user *u,
2922 int val; 2922 int val;
2923 2923
2924 /* 2924 /*
2925 * FIXME: this is racy - the file-system might have already been 2925 * TODO: this is racy - the file-system might have already been
2926 * unmounted and we'd oops in this case. 2926 * unmounted and we'd oops in this case. The plan is to fix it with
2927 * help of 'iterate_supers_type()' which we should have in v3.0: when
2928 * a debugfs opened, we rember FS's UUID in file->private_data. Then
2929 * whenever we access the FS via a debugfs file, we iterate all UBIFS
2930 * superblocks and fine the one with the same UUID, and take the
2931 * locking right.
2932 *
2933 * The other way to go suggested by Al Viro is to create a separate
2934 * 'ubifs-debug' file-system instead.
2927 */ 2935 */
2928 if (file->f_path.dentry == d->dfs_dump_lprops) { 2936 if (file->f_path.dentry == d->dfs_dump_lprops) {
2929 dbg_dump_lprops(c); 2937 dbg_dump_lprops(c);