Message ID | 20180912125138.10751-1-s.hauer@pengutronix.de |
---|---|
State | Accepted |
Delegated to: | Richard Weinberger |
Headers | show |
Series | ubifs: drop false positive assertion | expand |
Sascha, Am Mittwoch, 12. September 2018, 14:51:38 CEST schrieb Sascha Hauer: > The following sequence triggers > > ubifs_assert(c, c->lst.taken_empty_lebs > 0); > > at the end of ubifs_remount_fs(): > > mount -t ubifs /dev/ubi0_0 /mnt > echo 1 > /sys/kernel/debug/ubifs/ubi0_0/ro_error > umount /mnt > mount -t ubifs -o ro /dev/ubix_y /mnt > mount -o remount,ro /mnt Ahh, ok. You have a unclean mount and then a read-only mount. Therefore UBIFs is still not clean but cannot do anything about that. > The resulting > > UBIFS assert failed in ubifs_remount_fs at 1878 (pid 161) > > is a false positive. In the case above c->lst.taken_empty_lebs has > never been changed from its initial zero value. This will only happen > when th> e deferred recovery is done. > > Fix this by doing the assertion only when recovery has been done > already. Makes sense! Thanks, //richard
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 23e7042666a7..617197e35749 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1912,7 +1912,9 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) mutex_unlock(&c->bu_mutex); } - ubifs_assert(c, c->lst.taken_empty_lebs > 0); + if (!c->need_recovery) + ubifs_assert(c, c->lst.taken_empty_lebs > 0); + return 0; }
The following sequence triggers ubifs_assert(c, c->lst.taken_empty_lebs > 0); at the end of ubifs_remount_fs(): mount -t ubifs /dev/ubi0_0 /mnt echo 1 > /sys/kernel/debug/ubifs/ubi0_0/ro_error umount /mnt mount -t ubifs -o ro /dev/ubix_y /mnt mount -o remount,ro /mnt The resulting UBIFS assert failed in ubifs_remount_fs at 1878 (pid 161) is a false positive. In the case above c->lst.taken_empty_lebs has never been changed from its initial zero value. This will only happen when the deferred recovery is done. Fix this by doing the assertion only when recovery has been done already. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- fs/ubifs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)