Unable to umount union-parts after umounting unionfs

From: Philip Paeps <philip_at_freebsd.org>
Date: Wed, 22 Jun 2005 08:53:57 +0200
When playing with union filesystems this morning, I noticed that it's not
possible to unmount the directory mounted on union cleanly, even after the
union has been cleanly unmounted, once you've read from the union:

Setup:

# touch fs1 fs2
# mkdir tstfs
# mdconfig -a -t vnode -f fs1 -s 16M
# mdconfig -a -t vnode -f fs2 -s 16M
# newfs /dev/md0
# newfs /dev/md1
# mount /dev/md0 tstfs/
# mount /dev/md1 /mnt
# mount -t unionfs /mnt tstfs/

Trying to umount /mnt now fails as expected:

# umount /mnt
umount: unmount of /mnt failed: Device busy

Unmounting after the union has been unmounted without anything having been
read from it or written to it, is no problem either:

# umount tstfs/
# umount /mnt

When something has been written to the union, but nothing has been read from
it, there's not problem either:

# touch tstfs/foo
# umount tstfs/
# umount /mnt

When something has been read, however:

# ls tstfs/
.snap/ foo
# umount tstfs/
# umount /mnt
umount: unmount of /mnt failed: Device busy

Strangely, when an 'empty' union is read from, there's no problem unmounting
it.  It's only when it's read when there's something on it.  In other words,
from a clean setup:

# ls tstfs/
.snap/
# umount tstfs/
# umount /mnt

But (continuing on the clean setup):

# mount /dev/md1 /mnt
# mount -t unionfs /mnt tstfs/
# touch tstfs/foo
# umount tstfs/
# umount /mnt
# mount /dev/md1 /mnt
# mount -t unionfs /mnt tstfs/
# ls tstfs/
.snap/ foo
# umount tstfs/
# umount /mnt
umount: unmount of /mnt failed: Device busy

Is anyone else seeing this? :-)

 - Philip

-- 
Philip Paeps                                    Please don't Cc me, I am
philip_at_freebsd.org                               subscribed to the list.

  BOFH Excuse #237:
    Plate voltage too low on demodulator tube
Received on Wed Jun 22 2005 - 04:54:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:37 UTC