[PATCH 2/2] UBIFS: do not forget to cancel timers

Artem Bityutskiy dedekind1 at gmail.com
Mon Oct 18 01:46:09 EDT 2010


From: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>

This is a bug-fix: when we unmount, and we are currently in R/O
mode because of an error - we do not sync write-buffers, which
means we also do not cancel write-buffer timers we may possibly
have armed. This patch fixes the issue.

The issue can easily be reproduced by enabling UBIFS failure debug
mode (echo 4 > /sys/module/ubifs/parameters/debug_tsts) and
unmounting as soon as a failure happen. At some point the system
oopses because we have an armed hrtimer but UBIFS is unmounted
already.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
---
 fs/ubifs/super.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 6ff2f80..98695f9 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1772,7 +1772,11 @@ static void ubifs_put_super(struct super_block *sb)
 				 */
 				ubifs_err("failed to write master node, "
 					  "error %d", err);
-		}
+		} else {
+			for (i = 0; i < c->jhead_cnt; i++)
+				/* Make sure write-buffer timers are canceled */
+				hrtimer_cancel(&c->jheads[i].wbuf.timer);
+ 		}
 	}
 
 	ubifs_umount(c);
-- 
1.7.2.3




More information about the linux-mtd mailing list