From: Nathan March <nathan@gt.net>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Block script unsafe when starting multiple devices in parallel
Date: Tue, 30 Aug 2011 10:37:14 -0700 [thread overview]
Message-ID: <4E5D1FCA.7010104@gt.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 938 bytes --]
Hi Guys,
Ran into an issue where losetup was failing, added some logging to it's
executions to see (first #'s are parent pid / pid):
32435 / 32438 - losetup -f
32436 / 32439 - losetup -f
32435 / 32438 - Exit code: 0
32435 / 32438 - Output: /dev/loop/10
32436 / 32439 - Exit code: 0
32436 / 32439 - Output: /dev/loop/10
32128 / 32451 - losetup /dev/loop/10 /mnt/xenDisks2/nathanxen2/backup_tmp
31934 / 32452 - losetup /dev/loop/10 /mnt/xenDisks1/nathanxen2/swap
Sometime's losetup seems to be stuck waiting on something else and since
multiple block devices are brought up in parallel, the block script
tries to use the same name for multiple loopback devices.
Fix for this is pretty straightforward - should just be letting losetup
figure out the device names itself, patch is attached.
- Nathan
--
Nathan March<nathan@gt.net>
Gossamer Threads Inc. http://www.gossamer-threads.com/
Tel: (604) 687-5804 Fax: (604) 687-5806
[-- Attachment #2: block.patch --]
[-- Type: text/plain, Size: 1107 bytes --]
--- block.orig 2011-08-30 10:17:05.663106731 -0700
+++ block 2011-08-30 10:18:49.742946473 -0700
@@ -292,12 +292,12 @@
done
fi
- loopdev=$(losetup -f 2>/dev/null || find_free_loopback_dev)
- if [ "$loopdev" = '' ]
- then
- release_lock "block"
- fatal 'Failed to find an unused loop device'
- fi
+ #loopdev=$(losetup -f 2>/dev/null || find_free_loopback_dev)
+ #if [ "$loopdev" = '' ]
+ #then
+ # release_lock "block"
+ # fatal 'Failed to find an unused loop device'
+ #fi
if LANG=C losetup -h 2>&1 | grep read-only >/dev/null
then
@@ -305,7 +305,12 @@
else
roflag=''
fi
- do_or_die losetup $roflag "$loopdev" "$file"
+
+ loopdev=$(losetup -f "$file" --show)
+ if [[ $? -ne 0 ]]; then
+ fatal "Unable to bring up $file - $loopdev"
+ fi;
+ #do_or_die losetup $roflag "$loopdev" "$file"
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2011-08-30 17:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 17:37 Nathan March [this message]
2011-08-30 18:32 ` Block script unsafe when starting multiple devices in parallel Marek Marczykowski
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=4E5D1FCA.7010104@gt.net \
--to=nathan@gt.net \
--cc=xen-devel@lists.xensource.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.