From 47cbff34fa9a88fc8c12c4de15882a0563a33055 Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Sat, 29 Jul 2017 19:52:47 +0000 Subject: Add kernel support for the NFS client forced dismount "umount -N" option. When an NFS mount is hung against an unresponsive NFS server, the "umount -f" option can be used to dismount the mount. Unfortunately, "umount -f" gets hung as well if a "umount" without "-f" has already been done. Usually, this is because of a vnode lock being held by the "umount" for the mounted-on vnode. This patch adds kernel code so that a new "-N" option can be added to "umount", allowing it to avoid getting hung for this case. It adds two flags. One indicates that a forced dismount is about to happen and the other is used, along with setting mnt_data == NULL, to handshake with the nfs_unmount() VFS call. It includes a slight change to the interface used between the client and common NFS modules, so I bumped __FreeBSD_version to ensure both modules are rebuilt. Tested by: pho Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11735 --- sys/nfs/nfs_nfssvc.c | 2 +- sys/nfs/nfssvc.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/nfs') diff --git a/sys/nfs/nfs_nfssvc.c b/sys/nfs/nfs_nfssvc.c index 1f2cdaf3f9d8..8c49a61f808c 100644 --- a/sys/nfs/nfs_nfssvc.c +++ b/sys/nfs/nfs_nfssvc.c @@ -92,7 +92,7 @@ sys_nfssvc(struct thread *td, struct nfssvc_args *uap) nfsd_call_nfsserver != NULL) error = (*nfsd_call_nfsserver)(td, uap); else if ((uap->flag & (NFSSVC_CBADDSOCK | NFSSVC_NFSCBD | - NFSSVC_DUMPMNTOPTS)) && nfsd_call_nfscl != NULL) + NFSSVC_DUMPMNTOPTS | NFSSVC_FORCEDISM)) && nfsd_call_nfscl != NULL) error = (*nfsd_call_nfscl)(td, uap); else if ((uap->flag & (NFSSVC_IDNAME | NFSSVC_GETSTATS | NFSSVC_GSSDADDPORT | NFSSVC_GSSDADDFIRST | NFSSVC_GSSDDELETEALL | diff --git a/sys/nfs/nfssvc.h b/sys/nfs/nfssvc.h index 4b51f7b02719..61ed1a3e7a43 100644 --- a/sys/nfs/nfssvc.h +++ b/sys/nfs/nfssvc.h @@ -70,6 +70,7 @@ #define NFSSVC_RESUMENFSD 0x08000000 #define NFSSVC_DUMPMNTOPTS 0x10000000 #define NFSSVC_NEWSTRUCT 0x20000000 +#define NFSSVC_FORCEDISM 0x40000000 /* Argument structure for NFSSVC_DUMPMNTOPTS. */ struct nfscl_dumpmntopts { -- cgit v1.2.3