config: Fix sysfs paths for partitions

generic/019 was failing with:

./tests/generic/019: line 65: /sys/block/pmem0p2/make-it-fail: No such file or directory

When using a partition, the file needed is located at
/sys/block/pmem0/pmem0p2/make-it-fail.

Rather than attempt to deduce whether a block device is a partition
or not, use the symlinks located in /sys/dev/block/ to find the right
location for the make-it-fail file.

Also change btrfs/088 to use the new _sysfs_dev function.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Matthew Wilcox
2015-05-26 12:51:57 +10:00
committed by Dave Chinner
parent a397d1aabe
commit 78bbab93d8
3 changed files with 18 additions and 10 deletions
+5 -7
View File
@@ -41,7 +41,7 @@ _need_to_be_root
_require_scratch
_require_fail_make_request
SCRATCH_BDEV=`_short_dev $SCRATCH_DEV`
SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
allow_fail_make_request()
{
@@ -61,17 +61,15 @@ disallow_fail_make_request()
start_fail_scratch_dev()
{
echo "Force SCRATCH_DEV device failure"
echo " echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
echo 1 > /sys/block/$SCRATCH_BDEV/make-it-fail
echo " echo 1 > $SYSFS_BDEV/make-it-fail" >> $seqres.full
echo 1 > $SYSFS_BDEV/make-it-fail
}
stop_fail_scratch_dev()
{
echo "Make SCRATCH_DEV device operable again"
echo " echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail" >> $seqres.full
echo 0 > /sys/block/$SCRATCH_BDEV/make-it-fail
echo " echo 0 > $SYSFS_BDEV/make-it-fail" >> $seqres.full
echo 0 > $SYSFS_BDEV/make-it-fail
}
_cleanup()