diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2011-05-29 20:55:23 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2011-05-29 20:55:23 +0000 |
commit | abff9de7bdb14557130acd411dda7cbd5f960c99 (patch) | |
tree | a893ca45461703db0f3b5a06281ef05630d5e49e /sys/nfsclient/nfs_vfsops.c | |
parent | 05e7cba7111f31880f8417bd021e471f5376a2a5 (diff) | |
download | FreeBSD-src-abff9de7bdb14557130acd411dda7cbd5f960c99.zip FreeBSD-src-abff9de7bdb14557130acd411dda7cbd5f960c99.tar.gz |
Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()
in the old NFS client so that a forced dismount doesn't
get stuck in the VFS_SYNC() call that happens before
VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client.
An additional change is needed before forced dismounts will work.
PR: kern/157365
MFC after: 2 weeks
Diffstat (limited to 'sys/nfsclient/nfs_vfsops.c')
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 79659d0..8498ee4 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -1408,10 +1408,20 @@ nfs_sync(struct mount *mp, int waitfor) td = curthread; + MNT_ILOCK(mp); + /* + * If a forced dismount is in progress, return from here so that + * the umount(2) syscall doesn't get stuck in VFS_SYNC() before + * calling VFS_UNMOUNT(). + */ + if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { + MNT_IUNLOCK(mp); + return (EBADF); + } + /* * Force stale buffer cache information to be flushed. */ - MNT_ILOCK(mp); loop: MNT_VNODE_FOREACH(vp, mp, mvp) { VI_LOCK(vp); |