|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH]Enable loopback disk image files on readonly nfs filesystem
Hi all,This small patch enables you to loopback disk image files on readonly nfs filesystem on some system. When we losetup a file on readonly nfs filesystem, it fails with: # losetup /dev/loop7 /data/vm/xen_el5_i386_para/system.raw /data/vm/xen_el5_i386_para/system.raw: Permission deniedNew version of losetup has add a "-r" option for readonly loop, which Linux kernel has supported for a long time. Some distribution (EL5 update, Fedora 8, etc.) have shipped it. This patch benefit this option while doesn't break the old versions of losetup. Signed-off-by: Zhigang Wang <zhigang.x.wang@xxxxxxxxxx> regards, zhigang --- xen-unstable/tools/examples/block.orig 2007-11-06 20:01:53.000000000
-0800
+++ xen-unstable/tools/examples/block 2007-11-06 20:03:14.000000000 -0800
@@ -326,7 +326,10 @@
fatal 'Failed to find an unused loop device'
fi
- do_or_die losetup "$loopdev" "$file"
+ status=$(losetup "$loopdev" "$file" || echo "failed")
+ if [ -n "$status" ]; then
+ do_or_die losetup -r "$loopdev" "$file"
+ fi
xenstore_write "$XENBUS_PATH/node" "$loopdev"
write_dev "$loopdev"
release_lock "block"
_______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |