Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Add comment warning about case with LOCKPARENT but ...



details:   https://anonhg.NetBSD.org/src/rev/d97b2a8a7652
branches:  trunk
changeset: 764086:d97b2a8a7652
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 11 02:21:01 2011 +0000

description:
Add comment warning about case with LOCKPARENT but not LOCKLEAF. bleh.

diffstat:

 sys/kern/vfs_lookup.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 9a16df00429b -r d97b2a8a7652 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 11 02:20:15 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 11 02:21:01 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.171 2011/04/11 02:20:15 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.172 2011/04/11 02:21:01 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1292,6 +1292,17 @@
                        return EROFS;
                }
                if ((cnp->cn_flags & LOCKLEAF) == 0) {
+                       /*
+                        * Note: if LOCKPARENT but not LOCKLEAF is
+                        * set, and searchdir == foundobj, this code
+                        * necessarily unlocks the parent as well as
+                        * the leaf. That is, just because you specify
+                        * LOCKPARENT doesn't mean you necessarily get
+                        * a locked parent vnode. The code in
+                        * vfs_syscalls.c, and possibly elsewhere,
+                        * that uses this combination "knows" this, so
+                        * it can't be safely changed. Feh. XXX
+                        */
                        VOP_UNLOCK(foundobj);
                }
 



Home | Main Index | Thread Index | Old Index