summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1995-07-13 17:55:12 +0000
committerdfr <dfr@FreeBSD.org>1995-07-13 17:55:12 +0000
commit7d556fc736c8df48fc645eae1d60840bf4e97735 (patch)
tree4a33fa31b002bce5289e2f3a1ba8f62f54ac92aa /sys/nfsclient
parent87b7f046f6ed31e26151ffdaaf5f6941edbd8308 (diff)
downloadFreeBSD-src-7d556fc736c8df48fc645eae1d60840bf4e97735.zip
FreeBSD-src-7d556fc736c8df48fc645eae1d60840bf4e97735.tar.gz
I believe that the following fix to nfs_vnops.c should do the trick w.r.t.
the problem "when a file is truncated on the server after being written on a client under NFSv3, the client doesn't see the size drop to zero". (As you noted, the problem is that NMODIFIED wasn't being cleared by nfs_close when it flushed the buffers. After checking through the code, the only place where NMODIFIED was used to test for the possibility of dirty blocks was in nfs_setattr(). The two cases are safe to do when there aren't dirty blocks, so I just took out the tests. Unfortunately, testing for v_dirtyblkhd.lh_first being non-null is not sufficient, since there are times when the code moves blocks to the clean list and then back to the dirty list.) Submitted by: rick@snowhite.cis.uoguelph.ca
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vnops.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index f4872fd..419ed15 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.5 (Berkeley) 2/13/94
- * $Id: nfs_vnops.c,v 1.18 1995/06/28 17:33:39 dfr Exp $
+ * $Id: nfs_vnops.c,v 1.19 1995/07/13 08:47:55 davidg Exp $
*/
/*
@@ -506,9 +506,10 @@ nfs_close(ap)
if (vp->v_type == VREG) {
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NQNFS) == 0 &&
(np->n_flag & NMODIFIED)) {
- if (NFS_ISV3(vp))
+ if (NFS_ISV3(vp)) {
error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_p, 0);
- else
+ np->n_flag &= ~NMODIFIED;
+ } else
error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1);
np->n_attrstamp = 0;
}
@@ -599,22 +600,20 @@ nfs_setattr(ap)
vap->va_size = VNOVAL;
break;
default:
- if (np->n_flag & NMODIFIED) {
- if (vap->va_size == 0)
+ if (vap->va_size == 0)
error = nfs_vinvalbuf(vp, 0,
ap->a_cred, ap->a_p, 1);
- else
+ else
error = nfs_vinvalbuf(vp, V_SAVE,
ap->a_cred, ap->a_p, 1);
- if (error)
+ if (error)
return (error);
- }
tsize = np->n_size;
np->n_size = np->n_vattr.va_size = vap->va_size;
vnode_pager_setsize(vp, (u_long)np->n_size);
};
} else if ((vap->va_mtime.ts_sec != VNOVAL ||
- vap->va_atime.ts_sec != VNOVAL) && (np->n_flag & NMODIFIED) &&
+ vap->va_atime.ts_sec != VNOVAL) &&
vp->v_type == VREG &&
(error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
ap->a_p, 1)) == EINTR)
@@ -2878,7 +2877,6 @@ loop:
error = np->n_error;
np->n_flag &= ~NWRITEERR;
}
- np->n_flag &= ~NMODIFIED;
return (error);
}
OpenPOWER on IntegriCloud