nullfs: fix unmounts when filesystem is active.
If vflush() did not completely flushed the mount vnodes queue, either retry for forced unmounts, or give up for non-forced. This situation can occur when new vnodes are instantiated while vflush() worked. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
8b0f6c4215
commit
7ae3486e6d
@ -235,7 +235,7 @@ nullfs_unmount(mp, mntflags)
|
|||||||
{
|
{
|
||||||
struct null_mount *mntdata;
|
struct null_mount *mntdata;
|
||||||
struct mount *ump;
|
struct mount *ump;
|
||||||
int error, flags;
|
int error, flags, rootrefs;
|
||||||
|
|
||||||
NULLFSDEBUG("nullfs_unmount: mp = %p\n", (void *)mp);
|
NULLFSDEBUG("nullfs_unmount: mp = %p\n", (void *)mp);
|
||||||
|
|
||||||
@ -244,10 +244,20 @@ nullfs_unmount(mp, mntflags)
|
|||||||
else
|
else
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
/* There is 1 extra root vnode reference (nullm_rootvp). */
|
for (rootrefs = 1;; rootrefs = 0) {
|
||||||
error = vflush(mp, 1, flags, curthread);
|
/* There is 1 extra root vnode reference (nullm_rootvp). */
|
||||||
if (error)
|
error = vflush(mp, rootrefs, flags, curthread);
|
||||||
return (error);
|
if (error)
|
||||||
|
return (error);
|
||||||
|
MNT_ILOCK(mp);
|
||||||
|
if (mp->mnt_nvnodelistsize == 0) {
|
||||||
|
MNT_IUNLOCK(mp);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MNT_IUNLOCK(mp);
|
||||||
|
if ((mntflags & MNT_FORCE) == 0)
|
||||||
|
return (EBUSY);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finally, throw away the null_mount structure
|
* Finally, throw away the null_mount structure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user