xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jason Andryuk <jandryuk@gmail.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Subject: [Xen-devel] block scripts file:// check_sharing bug
Date: Wed, 26 Feb 2020 10:55:06 -0500	[thread overview]
Message-ID: <CAKf6xpv-U91nF2Fik7GRN3SFeOWWcdR5R+ZcK5fgojE+-D43sg@mail.gmail.com> (raw)


I've noticed a couple of issues in the block script check_sharing
function.  Right now, loopback file can be assigned multiple times to
multiple VMs.

The first issue is `stat -c '%D'` is used to get the device number of
the file in hexadecimal, but losetup prints the device number as

$ sudo losetup /dev/loop1
/dev/loop1: [64770]:84856 (/svr/raw.img)
$ stat -c %d /svr/raw.img
$ stat -c %D /svr/raw.img

I found this on CentOS7, but it looks like losetup has returned
decimal since 2011.
changed from show_loop_fd using PRIx64 to printf_loopdev with "%04d".

The second I'm not sure how to correct.  Hence this email instead of a patch.

When a loop device is created, the loopdev's major:minor is stored
into the physical-device node.  When check_sharing iterates through
the physical-device nodes, it is using the file's major:minor.  So
even though /dev/loop0 already exists pointing to a given file, it
doesn't get matched.  It seems like files should be handled in terms
of block-device & filepath/inode separately from the blockdevice
major:minor.  Maybe check_sharing needs to match the losetup output
against the files paths when creating devmm?


Xen-devel mailing list

                 reply	other threads:[~2020-02-26 15:55 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKf6xpv-U91nF2Fik7GRN3SFeOWWcdR5R+ZcK5fgojE+-D43sg@mail.gmail.com \
    --to=jandryuk@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [Xen-devel] block scripts file:// check_sharing bug' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).