MTD/JFFS2 bug - misreported filesystem usage
hi all,
I found a reproducable bug in the version of mtd/jffs2 that i have. I'm using kernel 2.4.19-rmk7, and an MTD snapshot from March 25/2003. My 'df' command comes from busybox version 0.60.5.
Bug: misreported filesystem usage
Procedure to reproduce:
1) boot system (this unlocks a NOR flash MTD area on which JFFS2 gets mounted)
2) 'df' to see filesystem usage
3) umount jffs2 partition
4) erase mtd partition which had jffs2 filesystem
5) mount jffs2 on newly erased partition
6) 'df' to see filesystem usage.
"Used" and "Available" fields are switched; switch is reflected in the
"Use%" field
7) write a file to JFFS2 filesystem
8) 'df' to see filesystem usage
The filesystem usage is now reported accurately.
Signature · 2 lines
Cameron Mayor Iders Incorporated
Quoted 5 lines · Cam Mayor
4) erase mtd partition which had jffs2 filesystem
5) mount jffs2 on newly erased partition
6) 'df' to see filesystem usage.
"Used" and "Available" fields are switched; switch is reflected in the
"Use%" field
We make crap up in statfs().
In particular, we account erasing but not-yet-erased blocks as unavailable, since the erase may fail. After mounting a newly-erased device, JFFS2 sticks every single erase block on the list to be erased, and that's why the space accounting goes haywire. It's not assuming that any of those erases will succeed until such time as they actually do.
After mounting, just keep running 'df' and watching the free space rise...
Signature · 1 line
dwmw2