* [PATCH] ubifs: drop false positive assertion
@ 2018-09-12 12:51 Sascha Hauer
2018-09-15 7:30 ` Richard Weinberger
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2018-09-12 12:51 UTC (permalink / raw)
To: linux-mtd; +Cc: Richard Weinberger, kernel, 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
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(-)
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;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ubifs: drop false positive assertion
2018-09-12 12:51 [PATCH] ubifs: drop false positive assertion Sascha Hauer
@ 2018-09-15 7:30 ` Richard Weinberger
0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2018-09-15 7:30 UTC (permalink / raw)
To: Sascha Hauer; +Cc: linux-mtd, kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-15 7:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12 12:51 [PATCH] ubifs: drop false positive assertion Sascha Hauer
2018-09-15 7:30 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox