summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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