On Sun, Apr 17, 2011 at 11:04:04PM +0000, Rick Macklem wrote: > Author: rmacklem > Date: Sun Apr 17 23:04:03 2011 > New Revision: 220761 > URL: http://svn.freebsd.org/changeset/base/220761 > > Log: > Add checks for MNTK_UNMOUNTF at the beginning of three > functions, so that threads don't get stuck in them during > a forced dismount. nfs_sync/VFS_SYNC() needs this, since it is > called by dounmount() before VFS_UNMOUNT(). The nfscl_nget() > case makes sure that a thread doing an VOP_OPEN() or > VOP_ADVLOCK() call doesn't get blocked before attempting > the RPC. Attempting RPCs don't block, since they all > fail once a forced dismount is in progress. > The third one at the beginning of nfsrpc_close() > is done so threads don't get blocked while doing VOP_INACTIVE() > as the vnodes are cleared out. > With these three changes plus a change to the umount(1) > command so that it doesn't do "sync()" for the forced case > seem to make forced dismounts work for the experimental NFS > client. > > MFC after: 2 weeks > > Modified: > head/sys/fs/nfsclient/nfs_clrpcops.c > head/sys/fs/nfsclient/nfs_clstate.c > head/sys/fs/nfsclient/nfs_clvfsops.c > > Modified: head/sys/fs/nfsclient/nfs_clrpcops.c > ============================================================================== > --- head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 17 22:31:36 2011 > (r220760) > +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 17 23:04:03 2011 > (r220761) > @@ -567,6 +567,11 @@ nfsrpc_close(vnode_t vp, int doclose, NF > > if (vnode_vtype(vp) != VREG) > return (0); > + > + /* For forced unmounts, just return. */ > + if ((vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF) != 0) > + return (0); > + Is there anything that would prevent the MNTK_UNMOUNTF flag from being set immediately after the test returned success ?
Usually, the tests for MNTK_UNMOUNTF are bugs. I coould see how terminating the RPCs would be useful for forced unmounts, but do not think that preventing entry into close would help. > if (doclose) > error = nfscl_doclose(vp, &clp, p); > else >
pgplQQzbmwDZO.pgp
Description: PGP signature