diff options
author | iedowse <iedowse@FreeBSD.org> | 2002-01-10 01:59:30 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2002-01-10 01:59:30 +0000 |
commit | 83b07d10e7c28afeb6242eaeb47da951e9bbc295 (patch) | |
tree | 6ba4599a5339e59ace58fd79bedba879cd060417 /sys | |
parent | 9f1ff731e4a0e7a77a78d129ee22a25160c92e21 (diff) | |
download | FreeBSD-src-83b07d10e7c28afeb6242eaeb47da951e9bbc295.zip FreeBSD-src-83b07d10e7c28afeb6242eaeb47da951e9bbc295.tar.gz |
Change dounmount() to return EBUSY in the non-MNT_FORCE case if we
can't acquire the mnt_lock without blocking. Normally non-forced
unmount attempts return EBUSY quickly if any vnodes are active, so
this just extends that behaviour to cover the per-mount mnt_lock
too.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_extattr.c | 9 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index a54c81a..fced0d7 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -553,7 +553,14 @@ dounmount(mp, flags, td) mtx_lock(&mountlist_mtx); mp->mnt_kern_flag |= MNTK_UNMOUNT; - lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK, &mountlist_mtx, td); + error = lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK | + ((flags & MNT_FORCE) ? 0 : LK_NOWAIT), &mountlist_mtx, td); + if (error) { + mp->mnt_kern_flag &= ~MNTK_UNMOUNT; + if (mp->mnt_kern_flag & MNTK_MWAIT) + wakeup((caddr_t)mp); + return (error); + } vn_start_write(NULL, &mp, V_WAIT); if (mp->mnt_flag & MNT_EXPUBLIC) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a54c81a..fced0d7 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -553,7 +553,14 @@ dounmount(mp, flags, td) mtx_lock(&mountlist_mtx); mp->mnt_kern_flag |= MNTK_UNMOUNT; - lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK, &mountlist_mtx, td); + error = lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK | + ((flags & MNT_FORCE) ? 0 : LK_NOWAIT), &mountlist_mtx, td); + if (error) { + mp->mnt_kern_flag &= ~MNTK_UNMOUNT; + if (mp->mnt_kern_flag & MNTK_MWAIT) + wakeup((caddr_t)mp); + return (error); + } vn_start_write(NULL, &mp, V_WAIT); if (mp->mnt_flag & MNT_EXPUBLIC) |