All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <aelder@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests: support post-udev device mapper nodes
Date: Mon, 2 May 2011 14:32:59 -0500	[thread overview]
Message-ID: <1304364779.3077.41.camel@doink> (raw)
In-Reply-To: <20110502160232.GA14457@infradead.org>

On Mon, 2011-05-02 at 12:02 -0400, Christoph Hellwig wrote:
> 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.

I'm not 100% sure I'm parsing the above right.  What
I read is that, although we want to use the "real"
device (not the link), the utilities tend to report
the /dev/mapper names.  Therefore we want to use
/dev/mapper names and internally translate them to
their real devices.

Based on that understanding I think what you're trying
to do is fine, but there a few problems with what you sent.
Note that I'm not even looking at the specifics of
/dev/mapper links at the moment.

> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: xfstests-dev/common.rc
> ===================================================================
> --- xfstests-dev.orig/common.rc	2011-05-02 12:45:25.000000000 +0000
> +++ xfstests-dev/common.rc	2011-05-02 12:45:28.000000000 +0000
> @@ -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}`

Although it typically shouldn't, if the "readlink -f" fails,
it will make _dev have an empty value...

> +    fi
> +
> +    if [ -b ${_dev} ]; then

...which will lead to some sort of shell "syntax error"
message here, which is rather unhelpful.

At a minimum, I think putting quotes around it here
would avoid that (but you should test), i.e.,
    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
> @@ -700,10 +707,12 @@ _require_scratch()
>  	*)
>  		 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
>  		 then
> +		     echo "no a block device";

This and the next one appear to be junk that should
be removed.

>  		     _notrun "this test requires a valid \$SCRATCH_DEV"
>  		 fi
>  		 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
>  		 then
> +		    echo "foo"
>  		     _notrun "this test requires a valid \$SCRATCH_DEV"
>  		 fi
>  		if [ ! -d "$SCRATCH_MNT" ]
> Index: xfstests-dev/README.device-mapper
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ xfstests-dev/README.device-mapper	2011-05-02 15:51:24.000000000 +0000
> @@ -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
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-05-02 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 16:02 [PATCH] xfstests: support post-udev device mapper nodes Christoph Hellwig
2011-05-02 19:32 ` Alex Elder [this message]
2011-05-02 19:35   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304364779.3077.41.camel@doink \
    --to=aelder@sgi.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.