On 03/17/2014 06:29 PM, Stanislav Kholmanskikh wrote:
> Hi!
>
> On 14.03.2014 00:56, Mike Frysinger wrote:
>> On Thu 13 Mar 2014 16:38:25 Stanislav Kholmanskikh wrote:
>>>             echo "Running ls -lR $MNT_POINT Command"
>>> -           ls -lR $MNT_POINT
>>> +           ls -lR $MNT_POINT > /dev/null
>>
>> the point of this command is to show the contents of the mount.  if you're 
>> not
>> doing that, then delete the call (and the echo above it).
>
> Ok. I'll delete this call.
>
>
>> -mike
>>

I think we were incorrect about it.

The implicit point of the above commands is to give the OS (kernel/udev) 
some time to complete all actions needed to handle a new loop device 
creation situation.

For example, consider this script:

#!/bin/sh

for mount_opt in \
         "loop" \
         "loop,norock" \
         "loop,nojoliet" \
         "loop,block=512,unhide" \
         "loop,block=2048,nocompress" \
         "loop,check=strict,map=off,gid=bin,uid=bin" \
         "loop,check=strict,map=acorn,gid=bin,uid=bin" \
         "loop,check=relaxed,map=normal" \
         "loop,block=512,unhide,session=2"
do
         echo "mount_opt = $mount_opt"
         losetup -a
         mount -t iso9660 -o $mount_opt /tmp/isofs.iso /tmp/mnt
#        ls -lR /tmp/mnt > /dev/null
         umount /tmp/mnt

done

sleep 2
echo "after sleep"
losetup -a

If we execute it, we may get:
mount_opt = loop
mount_opt = loop,norock
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,nojoliet
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=512,unhide
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=2048,nocompress
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=strict,map=off,gid=bin,uid=bin
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=strict,map=acorn,gid=bin,uid=bin
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=relaxed,map=normal
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=512,unhide,session=2
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop4: [fc00]:131091 (/tmp/isofs.iso)
after sleep

And if we uncomment 'ls -lR > /dev/null', we will get a clean output:
mount_opt = loop
mount_opt = loop,norock
mount_opt = loop,nojoliet
mount_opt = loop,block=512,unhide
mount_opt = loop,block=2048,nocompress
mount_opt = loop,check=strict,map=off,gid=bin,uid=bin
mount_opt = loop,check=strict,map=acorn,gid=bin,uid=bin
mount_opt = loop,check=relaxed,map=normal
mount_opt = loop,block=512,unhide,session=2
after sleep

So the more test cases we have the higher the probability is that sooner 
or later the OS will have no available loop devices.

The above commands were executed on a kernel with 
a1ecac3b0656a68259927c234e505804d33a7b83 patch.

I think that according to the patch the described behaviour is 
absolutely expected. Therefore It would be better to leave "ls -lR" in 
the test or insert a 'sleep' instead. In this case we would use no more 
than 2 loop devices per iteration.

Guys, what do you think?

PS: On a kernel without this patch it's very likely that an umount 
operation will fail with:
loop: can't delete device /dev/loop0: Device or resource busy


>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to