amd64/180894: rm -rf causes kernel panic

Dieter BSD dieterbsd at
Sun Jul 28 17:40:48 UTC 2013

David writes:
> I also don't think it's reasonable for the kernel to bomb
> when it encounters corruption on a disk.

Agreed. Perhaps do a forced umount of the fs to prevent further
damage (and send a message to syslog), but processes not using that
fs should not be impacted. (For example, those processes might be
logging data that will not be available again.)

> The trouble is that it's tricky to test properly without finding a
> good way to corrupt the link count :-)

Doesn't sound tooooo hard.  Find a scratch partition, newfs a fs.
Make a few directories. Umount. Find a disk sector in that partition
with inodes for one of the directories.  Edit the link count for
a directory, write the sector out to disk.  Optional: fsck -p
to verify the problem.  Mount the fs.  Test your fix.

This problem is, of course, not limited to a bad link count.
There are lots of problems with a fs, disk, whatever,
that cause a panic but shouldn't.  :-(

More information about the freebsd-amd64 mailing list