Skip to contentSkip to conversation

xfstests: support post-udev device mapper nodes

PATCH In review Christoph Hellwig 2 participants 2 messages May 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

common.rc +8 -1
Index: xfstests-dev/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
README.device-mapper new file +8 -0
Index: xfstests-dev/README.device-mapper
===================================================================
@@ -0,0 +1,8 @@
+
+To use xfstests on device mapper always use the /dev/mapper/<name> symlinks,
+not the /dev/dm-* devices, or the symlinks created by LVM.
+
+For example:
+
+TEST_DEV=/dev/mapper/test
+SCRATCH_DEV=/dev/mapper/scratch

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Christoph Hellwig

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.

Looks good to me.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs