diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2009-05-27 19:41:29 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2009-05-27 19:41:29 +0000 |
commit | 7afd0592a260aa2b856a949f8496dc1010efc9d4 (patch) | |
tree | d85cc789e874e60f81551b90c42f3698ac72e5d7 /sys/fs | |
parent | 6c6591677caf28235084e637ab52e600e4ae9037 (diff) | |
download | FreeBSD-src-7afd0592a260aa2b856a949f8496dc1010efc9d4.zip FreeBSD-src-7afd0592a260aa2b856a949f8496dc1010efc9d4.tar.gz |
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)
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsclient/nfs_clnode.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/fs/nfsclient/nfs_clnode.c b/sys/fs/nfsclient/nfs_clnode.c index 5148357..7de639b 100644 --- a/sys/fs/nfsclient/nfs_clnode.c +++ b/sys/fs/nfsclient/nfs_clnode.c @@ -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 */ |