Skip to contentSkip to conversation

fix losetup -r flag when sharing disk

PATCH New Zhigang Wang 1 participant 1 message Jan 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix losetup -r flag when sharing disk

hi keir,

this small patch fixes the losetup -r flag when we specify 'w!' to the disk mode.

the mode from canonicalise_mode can be 'r' 'w' or '!'. ian's patch doesn't consider the '!' case.

when I specify 'w!' to a disk mode, will results disk setup failure. log in /var/log/xen/xen-hotplug.log:
[--snip--]
losetup: invalid option -- !
usage:

 losetup loop_device                                       # give info
 losetup -d loop_device                                    # delete
 losetup -f                                                # find unused
 losetup -a                                                # list all used
 losetup -r                                                # read-only loop

losetup [-e encryption] [-o offset] [-r] {-f|loop_device} file # setup
xenstore-read: couldn't read path backend/vbd/1/768/node [--snip--]

ian, please confirm.

this patch should apply to xen-unstable and xen-3.2-testing as well.

regards,

zhigang

tools/examples/block renamed from tools/examples/block.orig +1 -1
@@ -329,7 +329,7 @@ mount it read-write in a guest domain."
 
         if LANG=C losetup -h 2>&1 | grep read-only >/dev/null
         then
-          roflag="-$mode"; roflag="${roflag#-w}"
+          roflag="-$mode"; roflag="${roflag#-w}"; roflag="${roflag#-!}"
         else
           roflag=''
         fi

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel