git: sys/dev/disk/dm: Fix race on pdev create
Tomohiro Kusumi
tkusumi at crater.dragonflybsd.org
Wed Oct 14 12:35:50 PDT 2015
commit ac816675c8321309b49d6a335f95c5388036803f
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date: Mon Oct 12 12:07:31 2015 +0900
sys/dev/disk/dm: Fix race on pdev create
List lookup and insert need to be atomic otherwise more than
one dm_pdev_t* for the same underlying device could exist.
Running the following two concurrently reproduces the race
where ${DEV} is the common underlying device.
=====(A)
#!/usr/local/bin/bash
kldload dm_target_linear
while [ 1 ]; do
dmsetup create linear1 --table "0 1000 linear ${DEV} 0"
dmsetup remove /dev/mapper/linear1
done
=====(B)
#!/usr/local/bin/bash
kldload dm_target_delay
while [ 1 ]; do
dmsetup create delay1 --table "0 1000 delay ${DEV} 0 10"
dmsetup remove /dev/mapper/delay1
done
Summary of changes:
sys/dev/disk/dm/dm_pdev.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ac816675c8321309b49d6a335f95c5388036803f
--
DragonFly BSD source repository
More information about the Commits
mailing list