GELI が壊れた2007年02月03日 09時21分39秒


% cd /usr/src/sys/geom/eli
% cvs stat -v g_eli.c
RCS file: /home/ncvs/src/sys/geom/eli/g_eli.c,v
Working file: g_eli.c
head: 1.34

...

revision 1.34
date: 2007/01/28 20:29:12;  author: pjd;  state: Exp;  lines: +7 -0
It is possible that GEOM taste provider before SMP is started.
We can't bind to a CPU which is not yet on-line, so add code that wait for
CPUs to go on-line before binding to them.

Reported by:    Alin-Adrian Anton 
MFC after:      2 weeks
----------------------------

この変更で GELI が壊れた。7.0-CURRENT が GELI のパスワードを入力した後、attach 出来ないのだ。


% cvs diff -r 1.33 -r 1.34 g_eli.c
Index: g_eli.c
===================================================================
RCS file: /home/ncvs/src/sys/geom/eli/g_eli.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- g_eli.c     2 Nov 2006 09:01:34 -0000       1.33
+++ g_eli.c     28 Jan 2007 20:29:12 -0000      1.34
@@ -25,7 +25,7 @@
  */
 
 #include 
-__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.33 2006/11/02 09:01:34 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/geom/eli/g_eli.c,v 1.34 2007/01/28 20:29:12 pjd Exp $");
 
 #include 
 #include 
@@ -324,6 +324,13 @@
 
        wr = arg;                  
        sc = wr->w_softc;
+#ifdef SMP
+       /* Before sched_bind() to a CPU, wait for all CPUs to go on-line. */
+       if (sc->sc_crypto == G_ELI_CRYPTO_SW && g_eli_threads == 0) {
+               while (!smp_started)
+                       tsleep(wr, 0, "geli:smp", hz / 4);
+       }
+#endif 
        mtx_lock_spin(&sched_lock);
        sched_prio(curthread, PRIBIO);
        if (sc->sc_crypto == G_ELI_CRYPTO_SW && g_eli_threads == 0

SMP 向けのコードらしい。GENEIC をほぼそのまま使っているので、options SMP は有効になっている。CPU が一つしか無いのが影響しているのだろうか。症状は、無限ループに陥っているような感じだ。

1.33 に戻したら、何も問題なく GELI を attach して起動できるようになった。

次回