Project

General

Profile

Submit #2851

[PATCH v1] sys/dev/disk/dm: Add dm-flakey target

Added by tkusumi over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
11/17/2015
Due date:
% Done:

0%

Estimated time:

Description

This patch is the initial version of dm-flakey target from Linux kernel.
https://www.dragonflybsd.org/~tkusumi/diff/0001-sys-dev-disk-dm-Add-dm-flakey-target.patch

===== Example1 - Error write I/Os
# kldload dm_target_flakey
# dmsetup create flakey1 --table "0 234436482 flakey /dev/da3 0 1 1"
# newfs_hammer -L TEST /dev/mapper/flakey1
Volume 0 DEVICE /dev/mapper/flakey1 size 111.79GB
initialize freemap volume 0
initializing the undo map (504 MB)
newfs_hammer: Write volume 0 (/dev/mapper/flakey1): Input/output error
# dmsetup remove /dev/mapper/flakey1

===== Example2 - Silently drop write I/Os
# newfs_hammer -L TEST /dev/da3 > /dev/null
# mount_hammer /dev/da3 /HAMMER
# cd /HAMMER
# git clone /usr/local/src/dragonfly
Cloning into 'dragonfly'...
done.
Checking out files: 100% (34434/34434), done.
# cd
# umount /HAMMER
# dmsetup create flakey2 --table "0 234436482 flakey /dev/da3 0 1 1 1 drop_writes"
# mount_hammer /dev/mapper/flakey2 /HAMMER
# dmesg | tail -3
HAMMER() Critical error inode=-1 error=5 while flushing meta-data
HAMMER() Forcing read-only mode
HAMMER(TEST) mounted clean, no recovery needed
# mount | grep "/HAMMER"
TEST on /HAMMER (hammer, local, read-only)
# cd /HAMMER/dragonfly
# git log -p > /dev/null; echo $?
0
# cd
# umount /HAMMER
# dmsetup remove /dev/mapper/flakey2

===== Example3 - Corrupt read I/Os
# dd if=/dev/zero of=/dev/da3 bs=1024 count=10000 >/dev/null 2>&1
# dmsetup create flakey3 --table "0 234436482 flakey /dev/da3 0 1 1 5 corrupt_bio_byte 1 r 65 0"
# od -tx1 /dev/mapper/flakey3 | head -10
0000000 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0010000 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0010020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0020000 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0030000 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# dmsetup remove /dev/mapper/flakey3
# kldunload dm_target_flakey

Also available in: Atom PDF