[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
kernel/2394: umount -f doesn't work with some filesystems
>Number: 2394
>Category: kernel
>Synopsis: umount -f doesn't work with some filesystems
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bugs
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 11 20:50:01 MST 2002
>Last-Modified:
>Originator: Peter Werner
>Organization:
IFOST: http://www.ifost.org.au - UNIX Consulting and Security
>Release: 3.0
>Environment:
System : OpenBSD 3.0
Architecture: OpenBSD.i386
Machine : i386
>Description:
tcfs, portalfs, kernfs and nullfs do not check for the FORCECLOSE flag
when deciding if the filesystem should be unmounted. They all return
EBUSY, regardless if it has been set, in their repsective unmount
operations.
I have not verified this with tcfs but it looks pretty much identical
to the others.
>How-To-Repeat:
I have snipped some output (from 'ls' and 'cat')
[swipperific|root]# mkdir /tmp/null
[swipperific|root]# mount_null /usr/include/ /tmp/null/
[swipperific|root]# cd /tmp/null/
[swipperific|null]# ls
[swipperific|null]# cd
[swipperific|root]# umount /tmp/null/
umount: /tmp/null/: Device busy
[swipperific|root]# umount -f /tmp/null/
umount: /tmp/null/: Device busy
[swipperific|root]#
[swipperific|root]# mkdir /kern
[swipperific|root]# mount_kernfs /kern /kern
[swipperific|root]# cd /kern/
[swipperific|kern]# ls
[swipperific|kern]# cat ncpu
[swipperific|kern]# cd
[swipperific|root]# umount /kern
umount: /kern: Device busy
[swipperific|root]# umount -f /kern
umount: /kern: Device busy
[swipperific|root]#
same with portalfs
>Fix:
This mimics umapfs
diff -ur e/sys/miscfs/kernfs/kernfs_vfsops.c sys/miscfs/kernfs/kernfs_vfsops.c
--- e/sys/miscfs/kernfs/kernfs_vfsops.c Tue Feb 12 12:30:15 2002
+++ sys/miscfs/kernfs/kernfs_vfsops.c Tue Feb 12 12:32:56 2002
@@ -188,7 +188,7 @@
* ever get anything cached at this level at the
* moment, but who knows...
*/
- if (rootvp->v_usecount > 1)
+ if (rootvp->v_usecount > 1 && !(flags & FORCECLOSE))
return (EBUSY);
#ifdef KERNFS_DIAGNOSTIC
diff -ur e/sys/miscfs/nullfs/null_vfsops.c sys/miscfs/nullfs/null_vfsops.c
--- e/sys/miscfs/nullfs/null_vfsops.c Tue Feb 12 12:30:15 2002
+++ sys/miscfs/nullfs/null_vfsops.c Tue Feb 12 12:33:26 2002
@@ -224,7 +224,7 @@
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
- if (nullm_rootvp->v_usecount > 1)
+ if (nullm_rootvp->v_usecount > 1 && !(flags & FORCECLOSE))
return (EBUSY);
if ((error = vflush(mp, nullm_rootvp, flags)) != 0)
return (error);
diff -ur e/sys/miscfs/portal/portal_vfsops.c sys/miscfs/portal/portal_vfsops.c
--- e/sys/miscfs/portal/portal_vfsops.c Tue Feb 12 12:30:15 2002
+++ sys/miscfs/portal/portal_vfsops.c Tue Feb 12 12:34:09 2002
@@ -169,7 +169,7 @@
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
- if (rootvp->v_usecount > 1)
+ if (rootvp->v_usecount > 1 && !(flags & FORCECLOSE))
return (EBUSY);
if ((error = vflush(mp, rootvp, flags)) != 0)
return (error);
diff -ur e/sys/miscfs/tcfs/tcfs_vfsops.c sys/miscfs/tcfs/tcfs_vfsops.c
--- e/sys/miscfs/tcfs/tcfs_vfsops.c Tue Feb 12 12:30:16 2002
+++ sys/miscfs/tcfs/tcfs_vfsops.c Tue Feb 12 12:39:01 2002
@@ -206,7 +206,7 @@
if (mntinvalbuf(mp, 1))
return (EBUSY);
#endif
- if (tcfsm_rootvp->v_usecount > 1)
+ if (tcfsm_rootvp->v_usecount > 1 && !(flags & FORCECLOSE))
return (EBUSY);
if ((error = vflush(mp, tcfsm_rootvp, flags)) != 0)
return (error);
>Audit-Trail:
>Unformatted: