tech-kern archive

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

Re: xxxVERBOSE module?



On Sun, 23 May 2010, Martin Husemann wrote:

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.

Moving the test up results in the following diff:

Index: vfs_lookup.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_lookup.c,v
retrieving revision 1.121
diff -u -p -r1.121 vfs_lookup.c
--- vfs_lookup.c        8 Jan 2010 11:35:10 -0000       1.121
+++ vfs_lookup.c        23 May 2010 12:32:05 -0000
@@ -329,6 +329,15 @@ namei_start2(struct namei_state *state)
        if (!error && ndp->ni_pathlen == 1)
                error = ENOENT;

+       /*
+        * Get root directory for the translation.
+        */
+       if (!error) {
+               cwdi = self->l_proc->p_cwdi;
+               if (__predict_false(cwdi == NULL))
+                       error = ENOENT;
+       }
+
        if (error) {
                PNBUF_PUT(cnp->cn_pnbuf);
                ndp->ni_vp = NULL;
@@ -336,10 +345,6 @@ namei_start2(struct namei_state *state)
        }
        ndp->ni_loopcnt = 0;

-       /*
-        * Get root directory for the translation.
-        */
-       cwdi = self->l_proc->p_cwdi;
        rw_enter(&cwdi->cwdi_lock, RW_READER);
        state->namei_startdir = cwdi->cwdi_rdir;
        if (state->namei_startdir == NULL)


Unfortunately, it doesn't help. Other than changing the offset for the namei+0x109 line (the next offset is 0x112), the backtrace is identical to the one posted earlier.

:(


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index