From 0a818862bb74932e15971ec8bedb55765ec3a3f6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 4 May 2011 16:28:32 +0200 Subject: [PATCH] xfstests: support post-udev device mapper nodes Because of udevs complaining device mapper now creates /dev/dm-N as the real device nodes, and just symlinks the /dev/mapper/ names to it. This would be easy if everything used the /dev/mapper clear names, but most system utilities translate them back to the /dev/mapper/ names and thus confuse various test cases. Add support to _is_block_dev to read symlinks, and add documentation on how to run xfstests on device mapper volumes. Signed-off-by: Christoph Hellwig Reviewed-by: Alex Elder --- README.device-mapper | 8 ++++++++ common.rc | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 README.device-mapper diff --git a/README.device-mapper b/README.device-mapper new file mode 100644 index 00000000..4ff68121 --- /dev/null +++ b/README.device-mapper @@ -0,0 +1,8 @@ + +To use xfstests on device mapper always use the /dev/mapper/ symlinks, +not the /dev/dm-* devices, or the symlinks created by LVM. + +For example: + +TEST_DEV=/dev/mapper/test +SCRATCH_DEV=/dev/mapper/scratch diff --git a/common.rc b/common.rc index 58e73187..e634fbb3 100644 --- a/common.rc +++ b/common.rc @@ -587,7 +587,14 @@ _is_block_dev() exit 1 fi - [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }' + _dev=$1 + if [ -L "${_dev}" ]; then + _dev=`readlink -f ${_dev}` + fi + + if [ -b "${_dev}" ]; then + src/lstat64 ${_dev} | $AWK_PROG '/Device type:/ { print $9 }' + fi } # Do a command, log it to $seq.full, optionally test return status -- 2.30.2