NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/54378 (panic with TLB miss when attempting to reboot)
The following reply was made to PR kern/54378; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: hannken%netbsd.org@localhost
Subject: Re: kern/54378 (panic with TLB miss when attempting to reboot)
Date: Thu, 18 Jul 2019 00:32:44 +0000
On Wed, Jul 17, 2019 at 10:25:01AM +0000, J. Hannken-Illjes wrote:
> On Tue, Jul 16, 2019 at 02:42:56PM +0000, dholland%NetBSD.org@localhost wrote:
> > I suspect the recent rootdir refcount changes in namei; could you take a
> > quick look? If not, please set it to me...
>
> No, we have "rootvnode == NULL", call namei() for "/mnt/netbsd" and
> come to namei_getstartdir(). Here we have "startdir == rootvnode == NULL",
> try to reference with vref(startdir) and bomb.
>
> This patch should fix it, please give it a try.
Guess it was my fault, thanks for taking care of it...
...under which circumstances I don't like to carp, but I'd suggest the
following patch instead so that relative lookups can still operate
when there's no root dir yet. This is not much immediate use, but is
likely to be helpful in the long run for things like mounting root on
cgd.
Index: vfs_lookup.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.211
diff -u -p -r1.211 vfs_lookup.c
--- vfs_lookup.c 6 Jul 2019 14:27:38 -0000 1.211
+++ vfs_lookup.c 18 Jul 2019 00:31:17 -0000
@@ -595,8 +595,10 @@ namei_getstartdir(struct namei_state *st
* Must hold references to rootdir and erootdir while we're running.
* A multithreaded process may chroot during namei.
*/
- vref(startdir);
- vref(state->ndp->ni_rootdir);
+ if (startdir != NULL)
+ vref(startdir);
+ if (state->ndp->ni_rootdir != NULL)
+ vref(state->ndp->ni_rootdir);
if (state->ndp->ni_erootdir != NULL)
vref(state->ndp->ni_erootdir);
state->root_referenced = 1;
@@ -616,6 +618,9 @@ namei_getstartdir_for_nfsd(struct namei_
KASSERT(state->ndp->ni_atdir != NULL);
/* always use the real root, and never set an emulation root */
+ if (rootvnode == NULL) {
+ return NULL;
+ }
state->ndp->ni_rootdir = rootvnode;
state->ndp->ni_erootdir = NULL;
@@ -693,6 +698,10 @@ namei_start(struct namei_state *state, i
namei_ktrace(state);
}
+ if (startdir == NULL) {
+ return ENOENT;
+ }
+
/* NDAT may feed us with a non directory namei_getstartdir */
if (startdir->v_type != VDIR) {
vrele(startdir);
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index