public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomas Racek <tracek@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: lczerner@redhat.com, xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] xfstests: Add new standard loop handling functions
Date: Tue, 5 Feb 2013 02:56:05 -0500 (EST)	[thread overview]
Message-ID: <2102910196.6066385.1360050965047.JavaMail.root@redhat.com> (raw)
In-Reply-To: <510E8B66.9040803@sandeen.net>

----- Original Message -----
> On 2/3/13 4:19 AM, Tomas Racek wrote:
> > Add _create_loop_device and _destroy_loop_device to uniformly
> > handle
> > loopback devices.
> 
> Good idea, small comment below
> 
> > Signed-off-by: Tomas Racek <tracek@redhat.com>
> > ---
> >  common.rc | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/common.rc b/common.rc
> > index 0cccb94..67a5e3a 100644
> > --- a/common.rc
> > +++ b/common.rc
> > @@ -1833,6 +1833,20 @@ _require_dumpe2fs()
> >  	fi
> >  }
> >  
> > +_create_loop_device()
> > +{
> > +	file=$1
> > +	dev=`losetup -f`
> > +	losetup $dev $file || _fail "Cannot associate $file with $dev"
> > +	echo $dev
> 
> In theory this is a little racy, right?  the loop device could become
> used in between.
> 
> I wonder if something like:
> 
> _create_loop_device()
> {
> 	dev=`losetup -f --show $file` || _fail "Cannot associate $file with
> 	$dev"
> 	echo $dev
> }
> 
> would work better?  From the manpage:
> 
>        -f, --find
>               find the first unused loop device. If a file argument
>               is present,
>                use this device. Otherwise, print its name
> 
>        --show print device name if the -f option and a file argument
>        are present.
> 
> So this will set up the first available loop device and print its
> name.

You're right, thanks for the suggestion!

Tom

> 
> Thanks,
> -Eric
> 
> > +}
> > +
> > +_destroy_loop_device()
> > +{
> > +	dev=$1
> > +	losetup -d $dev || _fail "Cannot destroy loop device $dev"
> > +}
> > +
> >  ################################################################################
> >  
> >  if [ "$iam" != new -a "$iam" != bench ]
> > 
> 
> _______________________________________________
> 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:[~2013-02-05  7:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-03 10:19 [PATCH 1/3] xfstests: Provide dumpe2fs via standard common.config interface Tomas Racek
2013-02-03 10:19 ` [PATCH 2/3] xfstests: Add new standard loop handling functions Tomas Racek
2013-02-03 16:08   ` Eric Sandeen
2013-02-05  7:56     ` Tomas Racek [this message]
2013-02-26 15:32       ` Rich Johnston
2013-02-03 10:19 ` [PATCH 3/3 V2] xfstests: 297: Test that FS sends discard requests only on free blocks Tomas Racek
2013-02-26 15:32   ` Rich Johnston
2013-02-20 20:17 ` [PATCH 1/3] xfstests: Provide dumpe2fs via standard common.config interface Ben Myers
2013-02-26 15:44 ` Rich Johnston

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=2102910196.6066385.1360050965047.JavaMail.root@redhat.com \
    --to=tracek@redhat.com \
    --cc=lczerner@redhat.com \
    --cc=sandeen@sandeen.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox