Skip to content

Commit

Permalink
tmpfs: Fix recursive fdvp lock in rename
Browse files Browse the repository at this point in the history
PR: kern/159418
  • Loading branch information
glk committed Aug 10, 2011
1 parent 3391d5c commit 15186db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/fs/tmpfs/tmpfs_vnops.c
Expand Up @@ -968,7 +968,7 @@ tmpfs_rename(struct vop_rename_args *v)

/* If we need to move the directory between entries, lock the
* source so that we can safely operate on it. */
if (tdvp != fdvp) {
if (fdvp != tdvp && fdvp != tvp) {
error = vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY);
if (error != 0)
goto out;
Expand Down Expand Up @@ -1145,7 +1145,7 @@ tmpfs_rename(struct vop_rename_args *v)
error = 0;

out_locked:
if (fdnode != tdnode)
if (fdvp != tdvp && fdvp != tvp)
VOP_UNLOCK(fdvp, 0);

out:
Expand Down

0 comments on commit 15186db

Please sign in to comment.