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

Re: [Xen-devel] Re: Virtual block devices (vbd) still not working... :-(



> Whenever Alex or I have used VDs they've just worked: There's
> no way to populate a vd with a file system unless you can access
> it from domain0, so its obviously been working for some people.
> 
> I wander if it's got something to do with whether the newly
> created virtual disk just happens to have something approximating
> a valid partition table or not?

I've now fully worked outwhat was going on. The reason it 
worked for you is pretty vile, so I'll describe it here :-)

After doing 'vbd create' you must have executed 'mkfs' as
non-root. The test machine was incorrectly set up so that users had
read and write access directly via the /dev/xvd* files (NB. I've
checked in a fixed xen-mkdevnodes that ensures this cannot happen).

However, although the device file gives you write access to make a
filesystem, the first thing mkfs does is an ioctl to find the device
size. We have a check for CAP_SYS_ADMIN in our ioctl function
(incorrectly, since permission checking is done when opening the /dev
file --- I'll check in a fix to remove that, and another, bogus
check).  

The ioctl returns -1 (errno==EPERM), but mkfs is broken and doesn't
check the return value. It therefore thinks it's dealing with an
enormous blkdev of size ~0UL :-)

It proceeds to write the inode and superblock info over the disk. Even
though access checks are probably failing, enough are successfully
written at the start of the vbd that mount can still work.

It's unfortunate that you get no errors for the access violations by
mkfs (it must surely be writing off the end of the 128M vbd). Xen
returns an error condition, and this is propagated by the xenolinux
driver, but it appears to be silently dropped by the generic blkdev
layer :-( :-(

I did have the xenolinux driver make a noise about errors before, but
it got rather messy at boot time (generic blkdev layer would pass down
requests that failed for legitimate reasons) so I removed it.

 -- Keir


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel


 


Rackspace

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