Using fault injection

Some time ago, I was playing with logfs, a scalable flash filesystem. It’s interesting because of at least three reasons:

  • it can compress data transparently,
  • it provides wear leveling,
  • it works with block devices.

In other words, a perfect filesystem to use for all flash-based devices, like USB-sticks.

Any filesystem should aim for high reliability, no doubt about it. But how to test it? Linux kernel provides a nice feature called “fault injection”. If Documentation/fault-injection/fault-injection.txt isn’t clear for you after the first read, here’s a quick help.

You need fault injection and debugfs compiled in the kernel.

First, mount debugfs:

Then, set up fault injection:

Mount the filesystem on the device, start copying files etc. and then, make the device fail:

Logfs was working for some time, but eventually, it failed – we can blame a proprietary nvidia module which tainted the kernel, of course 🙂FAULT_INJECTION:

Hopefully, the bug is not there anymore, as I notified the logfs’ author, Jörn Engel. He also fixed some other bugs I found.

I wonder if and how easy other filesystems can be abused with the fault injection?