« Return to Thread: kern/46221: Kernel panic in NFS server code

Re: kern/46221: Kernel panic in NFS server code

by Matthias Scheler-2 :: Rate this Message:

| View in Thread

The following reply was made to PR kern/46221; it has been noted by GNATS.

From: Matthias Scheler <tron@...>
To: "J. Hannken-Illjes" <hannken@...>
Cc: NetBSD GNATS <gnats-bugs@...>
Subject: Re: kern/46221: Kernel panic in NFS server code
Date: Wed, 21 Mar 2012 15:08:27 +0000

 On Wed, Mar 21, 2012 at 03:44:28PM +0100, J. Hannken-Illjes wrote:
 > <snip>
 > >
 > > Manual Bouyer has looked at this crash. The kernel paniced here:
 > >
 > >         ip = VTOI(nvp);
 > > -->     if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) {
 > >                 vput(nvp);
 > >                 *vpp = NULLVP;
 > >                 return (ESTALE);
 > >         }
 > >
 > > I guess that an extra check whether "ip" is NULL would prevent the
 > > panic. But I'm not sure whether that is the correct fix.
 >
 > Please change this to
 >
 > ip = VTOI(nvp);
 > + if (ip == NULL) {
 > + vprintf("NULL IP", nvp);
 > + panic("NULL IP");
 > + }
 > if (...
 >
 > so on the next crash we know more about the state of the vnode/inode.
 
 I've already changed it like this:
 
 Index: sys/ufs/ufs/ufs_vfsops.c
 ===================================================================
 RCS file: /cvsroot/src/sys/ufs/ufs/ufs_vfsops.c,v
 retrieving revision 1.50
 diff -u -r1.50 ufs_vfsops.c
 --- sys/ufs/ufs/ufs_vfsops.c 1 Feb 2012 05:34:43 -0000 1.50
 +++ sys/ufs/ufs/ufs_vfsops.c 21 Mar 2012 15:07:49 -0000
 @@ -223,7 +223,11 @@
  return (error);
  }
  ip = VTOI(nvp);
 - if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) {
 + if (ip == NULL || ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen) {
 + if (ip == NULL) {
 + aprint_normal("ufs_fhtovp: ip == NULL on vp %p\n",
 +    nvp);
 + }
  vput(nvp);
  *vpp = NULLVP;
  return (ESTALE);
 
 I'll check whether I get some of these kernel messages.
 
 > If you are able to debug the core dump you could `print *nvp' here.
 
 Kernel core dumps have never worked for me under NetBSD/amd64.
 
  Kind regards
 
 --
 Matthias Scheler                                  http://zhadum.org.uk/
 

 « Return to Thread: kern/46221: Kernel panic in NFS server code