Fix handling of NFSv4 Close operations in ncl_inactive(). Only

do them for NFSv4 and flush writes to the server before doing
the Close(s), as required. Also, use the a_td argument instead of
curthread.

Approved by:	kib (mentor)
This commit is contained in:
Rick Macklem 2009-05-27 19:41:29 +00:00
parent 3552092bb2
commit fdd88deeba
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192928

View File

@ -185,17 +185,23 @@ ncl_inactive(struct vop_inactive_args *ap)
{
struct nfsnode *np;
struct sillyrename *sp;
struct thread *td = curthread; /* XXX */
np = VTONFS(ap->a_vp);
if (prtactive && vrefcnt(ap->a_vp) != 0)
vprint("ncl_inactive: pushing active", ap->a_vp);
/*
* Since mmap()'d files to I/O after VOP_CLOSE(), the NFSv4 Close
* operations are delayed until now.
*/
(void) nfsrpc_close(ap->a_vp, 1, td);
if (NFS_ISV4(ap->a_vp)) {
/*
* Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4
* Close operations are delayed until now. Any dirty buffers
* must be flushed before the close, so that the stateid is
* available for the writes.
*/
if (nfscl_mustflush(ap->a_vp))
(void) ncl_flush(ap->a_vp, MNT_WAIT, NULL, ap->a_td,
1);
(void) nfsrpc_close(ap->a_vp, 1, ap->a_td);
}
if (ap->a_vp->v_type != VDIR) {
sp = np->n_sillyrename;
@ -203,7 +209,7 @@ ncl_inactive(struct vop_inactive_args *ap)
} else
sp = NULL;
if (sp) {
(void)ncl_vinvalbuf(ap->a_vp, 0, td, 1);
(void)ncl_vinvalbuf(ap->a_vp, 0, ap->a_td, 1);
/*
* Remove the silly file that was rename'd earlier
*/