Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern No, we can't elide the fs-wide rename lock for same...
details: https://anonhg.NetBSD.org/src/rev/49f279a77f41
branches: trunk
changeset: 782154:49f279a77f41
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Oct 19 02:07:22 2012 +0000
description:
No, we can't elide the fs-wide rename lock for same-directory rename.
rename("a/b", "a/c") and rename("a/c/x", "a/b/y") will deadlock.
Darn.
diffstat:
sys/kern/vfs_syscalls.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diffs (51 lines):
diff -r 8059d7a9c2f0 -r 49f279a77f41 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Thu Oct 18 19:33:38 2012 +0000
+++ b/sys/kern/vfs_syscalls.c Fri Oct 19 02:07:22 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.458 2012/10/12 02:37:20 riastradh Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.459 2012/10/19 02:07:22 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.458 2012/10/12 02:37:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.459 2012/10/19 02:07:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -4041,11 +4041,9 @@
* Take the vfs rename lock to avoid cross-directory screw cases.
* Nothing is locked currently, so taking this lock is safe.
*/
- if (fdvp != tdvp) {
- error = VFS_RENAMELOCK_ENTER(mp);
- if (error)
- goto abort1;
- }
+ error = VFS_RENAMELOCK_ENTER(mp);
+ if (error)
+ goto abort1;
/*
* Now fdvp, fvp, tdvp, and (if nonnull) tvp are referenced,
@@ -4186,15 +4184,13 @@
* So all we have left to do is to drop the rename lock and
* destroy the pathbufs.
*/
- if (fdvp != tdvp)
- VFS_RENAMELOCK_EXIT(mp);
+ VFS_RENAMELOCK_EXIT(mp);
goto out2;
abort3: if ((tvp != NULL) && (tvp != tdvp))
VOP_UNLOCK(tvp);
abort2: VOP_UNLOCK(tdvp);
- if (fdvp != tdvp)
- VFS_RENAMELOCK_EXIT(mp);
+ VFS_RENAMELOCK_EXIT(mp);
abort1: VOP_ABORTOP(tdvp, &tnd.ni_cnd);
vrele(tdvp);
if (tvp != NULL)
Home |
Main Index |
Thread Index |
Old Index