summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vnops.c
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2003-04-24 20:39:40 +0000
committertruckman <truckman@FreeBSD.org>2003-04-24 20:39:40 +0000
commit79b9eea6e85998e73ebbbe0d6dc6009bc2928ec2 (patch)
tree0b519fa276184dd140b3d99b3eab90bab3872815 /sys/nfsclient/nfs_vnops.c
parent88151c4f8ca4d10d745d93aa6b8fd9f458f69446 (diff)
downloadFreeBSD-src-79b9eea6e85998e73ebbbe0d6dc6009bc2928ec2.zip
FreeBSD-src-79b9eea6e85998e73ebbbe0d6dc6009bc2928ec2.tar.gz
VOP_FSYNC() expects to be called with the vnode locked, so lock fvp in
nfs_rename() before calling VOP_FSYNC() and unlock fvp immediately after. Reviewed by: bde
Diffstat (limited to 'sys/nfsclient/nfs_vnops.c')
-rw-r--r--sys/nfsclient/nfs_vnops.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index fbd4f68..a3f7d8f 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -1521,6 +1521,14 @@ nfs_rename(struct vop_rename_args *ap)
goto out;
}
+ if (fvp == tvp) {
+ printf("nfs_rename: fvp == tvp (can't happen)\n");
+ error = 0;
+ goto out;
+ }
+ if ((error = vn_lock(fvp, LK_EXCLUSIVE, fcnp->cn_thread)) != 0)
+ goto out;
+
/*
* We have to flush B_DELWRI data prior to renaming
* the file. If we don't, the delayed-write buffers
@@ -1529,8 +1537,8 @@ nfs_rename(struct vop_rename_args *ap)
* ( as far as I can tell ) it flushes dirty buffers more
* often.
*/
-
VOP_FSYNC(fvp, fcnp->cn_cred, MNT_WAIT, fcnp->cn_thread);
+ VOP_UNLOCK(fvp, 0, fcnp->cn_thread);
if (tvp)
VOP_FSYNC(tvp, tcnp->cn_cred, MNT_WAIT, tcnp->cn_thread);
OpenPOWER on IntegriCloud