[issue998] Unconfiguring a vn while it is mounted

Stathis Kamperis (via DragonFly issue tracker) sinknull at crater.dragonflybsd.org
Sun Feb 1 13:20:17 PST 2009


Stathis Kamperis <ekamperi at gmail.com> added the comment:

vnconfig supports creating a vnode pseudo disk device AND mounting it at the
same time, in the same line:

vnconfig -e /dev/vn0 lala.img mountro=/mnt/lala
vnconfig -u /dev/vn0

The problem is that when you try to unconfigure it, it only checks if the
mountro= or mountrw= "feature" was passed to it during its invokation. If you
didn't, it assumes that there is no mounted filesystem.

It doesn't take into account that a person could manually mount a vnode device
after vnconfig:

vnconfig /dev/vn0 lala.img
mount -o rdonly /dev/vn0 /mnt/lala
vnconfig -u /dev/vn0

My preliminary work is to introduce a function is_mounted() that *really* checks
if the /dev/vnX to be uncofigured is mounted to the filesystem. And it does by
calling getfsstat() to get a list of actively mounted filesystems.

Patch in:
http://stathisk.ath.cx/0001-Make-vnconfig-u-check-if-vnode-is-mounted-to-fs. patch

It ain't perfect, but it solves the problem for me (well, please test it and
provide feedback). Beside that, I sense that vnconfig's code needs some
refactoring, but let's tackle 1 issue at a time.

Best regards,
Stathis

----------
priority:  -> bug

_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue998>
_____________________________________________________





More information about the Bugs mailing list