All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <Anand.Jain@oracle.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org, xfs@oss.sgi.com, sandeen@redhat.com,
	zab@redhat.com
Subject: Re: [PATCH] xfstests: fix SCRATCH_DEV_POOL mount/umount issues
Date: Thu, 27 Jun 2013 15:30:57 +0800	[thread overview]
Message-ID: <51CBEA31.1020302@oracle.com> (raw)
In-Reply-To: <1372298261-16801-1-git-send-email-jbacik@fusionio.com>



On 06/27/2013 09:57 AM, Josef Bacik wrote:
> If you use the SCRATCH_DEV_POOL for btrfs you will end up with the command line
> like this
>
> mkfs.btrfs $SCRATCH_DEV_POOL $SCRATCH_DEV

> and btrfs does this thing where it makes the lowest valued device id show up in
> /proc/mounts no matter which device you specify at the mount command.  So in
> this case mount will show the first device in $SCRATCH_DEV_POOL instead of
> $SCRATCH_DEV,

  The first item in the SCRATCH_DEV_POOL is assigned to SCRATCH_DEV.
  The remaining will be used where more than one disk is needed.

> so anybody who wants to just use the scratch mnt with the scratch
> dev will fail to work because we never unmount the scratch mount.


>  Fix this by
> checking to see if the scratch dev pool is mounted at scratch mnt and unmount it
> so we can run our test.  Also fix scratch_unmount to call umount $SCRATCH_MNT
> instead of unmount $SCRATCH_DEV so it doesn't screw up with tests that use
> $SCRATCH_DEV_POOL.  This fixes the issue I was seeing by running
>
> ./check btrfs/307 generic/015
>
> Thanks,
>
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
>   common/rc |   19 ++++++++++++++++++-
>   1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index ad7cbc9..6e3ad65 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -280,7 +280,7 @@ _scratch_mount()
>
>   _scratch_unmount()
>   {
> -    $UMOUNT_PROG $SCRATCH_DEV
> +    $UMOUNT_PROG $SCRATCH_MNT
>   }

  This will fix the above problem for the reason mentioned.

>   _scratch_remount()
> @@ -938,6 +938,8 @@ _supported_os()
>   #
>   _require_scratch()
>   {
> +    local i
> +
>       case "$FSTYP" in
>   	nfs*)
>   		 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
> @@ -978,6 +980,21 @@ _require_scratch()
>               exit 1
>           fi
>       fi
> +
> +    # we may have a scratch dev pool specified, so make sure it's been unmounted
> +    # from the scratch mount
> +    for i in $SCRATCH_DEV_POOL; do
> +        if _mount | grep -q $i; then
> +            if ! _mount | grep $i | grep -q $SCRATCH_MNT; then
> +                echo "\$SCRATCH_DEV_POOL is mounted but not on \$SCRATCH_MNT - aborting"
> +                exit 1
> +            fi
> +            if ! $UMOUNT_PROG $i; then
> +                echo "failed to umount $i - aborting"
> +                exit 1
> +            fi
> +        fi
> +    done
>   }

   This looks some additional checks beyond the fix for above problem.
   Or did I miss something ? Further _is_mounted() can be used here.



Thanks
Anand

WARNING: multiple messages have this Message-ID (diff)
From: Anand Jain <Anand.Jain@oracle.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: sandeen@redhat.com, zab@redhat.com, linux-btrfs@vger.kernel.org,
	xfs@oss.sgi.com
Subject: Re: [PATCH] xfstests: fix SCRATCH_DEV_POOL mount/umount issues
Date: Thu, 27 Jun 2013 15:30:57 +0800	[thread overview]
Message-ID: <51CBEA31.1020302@oracle.com> (raw)
In-Reply-To: <1372298261-16801-1-git-send-email-jbacik@fusionio.com>



On 06/27/2013 09:57 AM, Josef Bacik wrote:
> If you use the SCRATCH_DEV_POOL for btrfs you will end up with the command line
> like this
>
> mkfs.btrfs $SCRATCH_DEV_POOL $SCRATCH_DEV

> and btrfs does this thing where it makes the lowest valued device id show up in
> /proc/mounts no matter which device you specify at the mount command.  So in
> this case mount will show the first device in $SCRATCH_DEV_POOL instead of
> $SCRATCH_DEV,

  The first item in the SCRATCH_DEV_POOL is assigned to SCRATCH_DEV.
  The remaining will be used where more than one disk is needed.

> so anybody who wants to just use the scratch mnt with the scratch
> dev will fail to work because we never unmount the scratch mount.


>  Fix this by
> checking to see if the scratch dev pool is mounted at scratch mnt and unmount it
> so we can run our test.  Also fix scratch_unmount to call umount $SCRATCH_MNT
> instead of unmount $SCRATCH_DEV so it doesn't screw up with tests that use
> $SCRATCH_DEV_POOL.  This fixes the issue I was seeing by running
>
> ./check btrfs/307 generic/015
>
> Thanks,
>
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
>   common/rc |   19 ++++++++++++++++++-
>   1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index ad7cbc9..6e3ad65 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -280,7 +280,7 @@ _scratch_mount()
>
>   _scratch_unmount()
>   {
> -    $UMOUNT_PROG $SCRATCH_DEV
> +    $UMOUNT_PROG $SCRATCH_MNT
>   }

  This will fix the above problem for the reason mentioned.

>   _scratch_remount()
> @@ -938,6 +938,8 @@ _supported_os()
>   #
>   _require_scratch()
>   {
> +    local i
> +
>       case "$FSTYP" in
>   	nfs*)
>   		 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
> @@ -978,6 +980,21 @@ _require_scratch()
>               exit 1
>           fi
>       fi
> +
> +    # we may have a scratch dev pool specified, so make sure it's been unmounted
> +    # from the scratch mount
> +    for i in $SCRATCH_DEV_POOL; do
> +        if _mount | grep -q $i; then
> +            if ! _mount | grep $i | grep -q $SCRATCH_MNT; then
> +                echo "\$SCRATCH_DEV_POOL is mounted but not on \$SCRATCH_MNT - aborting"
> +                exit 1
> +            fi
> +            if ! $UMOUNT_PROG $i; then
> +                echo "failed to umount $i - aborting"
> +                exit 1
> +            fi
> +        fi
> +    done
>   }

   This looks some additional checks beyond the fix for above problem.
   Or did I miss something ? Further _is_mounted() can be used here.



Thanks
Anand

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

  reply	other threads:[~2013-06-27  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27  1:57 [PATCH] xfstests: fix SCRATCH_DEV_POOL mount/umount issues Josef Bacik
2013-06-27  1:57 ` Josef Bacik
2013-06-27  7:30 ` Anand Jain [this message]
2013-06-27  7:30   ` Anand Jain

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=51CBEA31.1020302@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    --cc=zab@redhat.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.