tech-kern archive

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

Re: xxxVERBOSE module?



On Sat, May 22, 2010 at 08:29:22PM -0700, Paul Goyette wrote:
> attempt to load from the filesystem.  I expected it to fail, but the 
> failure mode is rather ungraceful 

Maybe this would help?

Index: vfs_lookup.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.121
diff -u -r1.121 vfs_lookup.c
--- vfs_lookup.c        8 Jan 2010 11:35:10 -0000       1.121
+++ vfs_lookup.c        23 May 2010 09:43:18 -0000
@@ -340,6 +340,11 @@
         * Get root directory for the translation.
         */
        cwdi = self->l_proc->p_cwdi;
+       if (__predict_false(cwdi == NULL)) {
+               PNBUF_PUT(cnp->cn_pnbuf);
+               ndp->ni_vp = NULL;
+               return ENONENT;
+       }
        rw_enter(&cwdi->cwdi_lock, RW_READER);
        state->namei_startdir = cwdi->cwdi_rdir;
        if (state->namei_startdir == NULL)

Or actually move that test up a few lines and use the existing if (error) exit.

Martin


Home | Main Index | Thread Index | Old Index