[Pkg-xen-devel] Bug#503044: xen-utils-common: should make the loopback device default to supporting more nodes

Anders Kaseorg andersk at MIT.EDU
Sun Aug 23 16:32:40 UTC 2009


On Wed, 22 Oct 2008, Russell Coker wrote:
> It seems reasonable to create a file /etc/modprobe.d/xen that contains 
> the following line to alleviate this:
> options loop max_loop=32

Since kernel 2.6.22, loop devices are allocated dynamically, so that you 
can `mknod /dev/loopN b 7 N` for any N and start using it immediately.  
The max_loop option causes more loop devices to be preallocated, but also 
disables dynamic allocation.

So maybe this problem is better solved by teaching /etc/xen/scripts/block 
to mknod a new loop device if it can’t find one free.  Untested patch:

--- xen-common/tools/hotplug/Linux/block
+++ xen-common/tools/hotplug/Linux/block
@@ -329,6 +329,13 @@
           fi
         done
 
+        if [ "$loopdev" = '' ]
+        then
+          loopdev=$(seq -f '/dev/loop%.f' 0 1048575 | \
+                    grep -Fxv -m1 -f <(echo /dev/loop* | tr ' ' '\n')) && \
+            mknod "$loopdev" b 7 "${loopdev#/dev/loop}"
+        fi
+
         if [ "$loopdev" = '' ]
         then
           release_lock "block"

Anders





More information about the Pkg-xen-devel mailing list