[Btrfs-devel] Oops

David Chinner dgc at sgi.com
Sun Dec 9 15:37:14 PST 2007


On Sat, Dec 08, 2007 at 09:01:24AM -0800, Zach Brown wrote:
> 
> >> $ mount -o loop /usr/portage.img /usr/portage/
> 
> >> $ mount -o loop,subvol=. /usr/portage.img /mnt/tmp/
> 
> > It's seem you setup two difference loopback devices on the same image
> > file. Please try mount the image file this way.
> 
> I think btrfs.ko should have a global list of uuids that are mounted.
> It could then forbid to mount a superblock with a uuid that is already
> mounted somewhere else.  Maybe it could only perform this check for
> writable mounts, which I suspect is all mounts today ;).

Check the XFS code - uuid_table_insert(), uuid_table_remove() and
xfs_uuid_mount(). it would probably be worthwhile making this a generic
uuid table and support infrastructure as MD also does some stuff
with uuids (e.g. uuid_equal()).

> It wouldn't be perfect but it is a trivial amount of code and it would
> have prevented this honest mistake.

Yup.

Note, it does mean snapshots have to have different UUIDs to the main
volume if they are independently mounted (hence xfs_admin -U).

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group



More information about the Btrfs-devel mailing list