* [Xen-devel] block scripts file:// check_sharing bug
@ 2020-02-26 15:55 Jason Andryuk
0 siblings, 0 replies; only message in thread
From: Jason Andryuk @ 2020-02-26 15:55 UTC (permalink / raw)
To: xen-devel
Hi,
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
decimal.
$ sudo losetup /dev/loop1
/dev/loop1: [64770]:84856 (/svr/raw.img)
$ stat -c %d /svr/raw.img
64770
$ stat -c %D /svr/raw.img
fd02
I found this on CentOS7, but it looks like losetup has returned
decimal since 2011.
https://github.com/karelzak/util-linux/commits/39fde1373d9f888b686fc8f780c05ba4091c70bd
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?
Regards,
Jason
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-26 15:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 15:55 [Xen-devel] block scripts file:// check_sharing bug Jason Andryuk
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).