From: Antoine Verheijen Date: Mon, 8 Feb 2010 22:33:38 +0000 (-0700) Subject: OpenBSD: allow for more graceful shutdown X-Git-Tag: openafs-devel-1_5_72~28 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5f39ae64bafe1e2073ff419fe62c2d5a86fc98f5;p=packages%2Fo%2Fopenafs.git OpenBSD: allow for more graceful shutdown A shutdown or unmount of AFS on OpenBSD will invariably result in a kernel panic. This is because the afs_unmount() routine does not (can not?) force vnode releases if the vnode is still busy. However, it continues on nonetheless and dies a horrible death a little later. This update causes a return from afs_unmount() with EBUSY if all the vnodes weren't released. This results in error messages on shutdown but the overall process continues more reliably and reboots, for example, work. There is likely a better solution to this but at least this is no worse than a system crash and it doesn't require console (or power button) intervention so it should do until I have the chance to explore further. Change-Id: Ia70f83bda748ea3d0b81b341a292e83121446567 Reviewed-on: http://gerrit.openafs.org/1275 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- diff --git a/src/afs/OBSD/osi_vfsops.c b/src/afs/OBSD/osi_vfsops.c index 40baec0b3..69a55800b 100644 --- a/src/afs/OBSD/osi_vfsops.c +++ b/src/afs/OBSD/osi_vfsops.c @@ -268,6 +268,13 @@ afs_unmount(afsp, flags, p) { extern int sys_ioctl(), sys_setgroups(); + struct vnode *vp; + + for (vp = LIST_FIRST(&afsp->mnt_vnodelist); vp != NULL; + vp = LIST_NEXT(vp, v_mntvnodes)) { + if (vp->v_usecount) return EBUSY; + } + AFS_STATCNT(afs_unmount); #ifdef AFS_DISCON_ENV give_up_cbs();