All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhignag Wang <zhigang.x.wang@oracle.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH]Enable loopback disk image files on readonly nfs filesystem
Date: Tue, 06 Nov 2007 20:08:41 -0800	[thread overview]
Message-ID: <47313A49.8040904@oracle.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

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 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>

regards,

zhigang

[-- Attachment #2: losetup-readonly.patch --]
[-- Type: text/x-patch, Size: 566 bytes --]

--- 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"

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2007-11-07  4:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47313A49.8040904@oracle.com \
    --to=zhigang.x.wang@oracle.com \
    --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.