[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] block scripts file:// check_sharing bug

  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jandryuk@xxxxxxxxx>
  • Date: Wed, 26 Feb 2020 10:55:06 -0500
  • Delivery-date: Wed, 26 Feb 2020 15:55:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.