Enable loopback disk image files on readonly nfs filesystem.

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 denied

New 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@oracle.com>
This commit is contained in:
Keir Fraser committed 2007-11-07 09:22:31 +00:00
1 parent 78a146f3c3
commit b2f3f8e649
1 file changed
+4 -1
+4 -1
View File
@@ -326,7 +326,10 @@ mount it read-write in a guest domain."
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"
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.