]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
* Debian kernels as of 2.6.20 enable CONFIG_PARAVIRT, which redefines
authorRuss Allbery <rra@debian.org>
Thu, 19 Apr 2007 18:30:43 +0000 (18:30 +0000)
committerRuss Allbery <rra@debian.org>
Thu, 19 Apr 2007 18:30:43 +0000 (18:30 +0000)
  several core kernel calls as redirects through a paravirt.ops table
  that's marked GPL-only.  This breaks all non-GPL modules that used
  those (previously generally exported) calls even indirectly.  Apply a
  hack to switch from spin_lock_irq to spin_lock_irqsave to avoid the
  paravirt redirection so that the module will build.

debian/changelog
debian/patches/paravirt-workaround [new file with mode: 0644]
src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_misc.c
src/afs/LINUX/osi_sleep.c
src/rx/LINUX/rx_kmutex.c

index 7ea44ad84be19f39fd1b483acbbef596263bad4b..2c87928a160191363625f2bd7fd15dd14bbc232c 100644 (file)
@@ -1,5 +1,11 @@
 openafs (1.4.4.dfsg1-2) unstable; urgency=low
 
+  * Debian kernels as of 2.6.20 enable CONFIG_PARAVIRT, which redefines
+    several core kernel calls as redirects through a paravirt.ops table
+    that's marked GPL-only.  This breaks all non-GPL modules that used
+    those (previously generally exported) calls even indirectly.  Apply a
+    hack to switch from spin_lock_irq to spin_lock_irqsave to avoid the
+    paravirt redirection so that the module will build.
   * Enable ucontext for all Linux builds with glibc 2.4 or later, not just
     with i386 and amd64.  Newer versions of glibc change internal
     structures in ways that cause the old LWP code to have stack
diff --git a/debian/patches/paravirt-workaround b/debian/patches/paravirt-workaround
new file mode 100644 (file)
index 0000000..be20d82
--- /dev/null
@@ -0,0 +1,146 @@
+Index: src/afs/LINUX/osi_machdep.h
+===================================================================
+RCS file: /cvs/openafs/src/afs/LINUX/osi_machdep.h,v
+retrieving revision 1.22.2.17
+diff -u -d -r1.22.2.17 osi_machdep.h
+--- src/afs/LINUX/osi_machdep.h        8 Feb 2007 22:41:20 -0000       1.22.2.17
++++ src/afs/LINUX/osi_machdep.h        18 Apr 2007 23:23:28 -0000
+@@ -55,14 +55,14 @@
+ #endif
+ #if defined (STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK)
+-#define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
++#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sigmask_lock,flags)
++#define SIG_UNLOCK(X),flags spin_unlock_irqrestore(&X->sigmask_lock,flags)
+ #elif defined (STRUCT_TASK_STRUCT_HAS_SIGHAND)
+-#define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
++#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sighand->siglock,flags)
++#define SIG_UNLOCK(X,flags) spin_unlock_irqrestore(&X->sighand->siglock,flags)
+ #else
+-#define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
+-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
++#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sig->siglock,flags)
++#define SIG_UNLOCK(X,flags) spin_unlock_irqrestore(&X->sig->siglock,flags)
+ #endif
+ #if defined (STRUCT_TASK_STRUCT_HAS_RLIM)
+Index: src/afs/LINUX/osi_misc.c
+===================================================================
+RCS file: /cvs/openafs/src/afs/LINUX/osi_misc.c,v
+retrieving revision 1.34.2.10
+diff -u -d -r1.34.2.10 osi_misc.c
+--- src/afs/LINUX/osi_misc.c   11 Jul 2005 19:29:56 -0000      1.34.2.10
++++ src/afs/LINUX/osi_misc.c   18 Apr 2007 23:23:28 -0000
+@@ -353,10 +353,11 @@
+ void
+ osi_linux_mask(void)
+ {
+-    SIG_LOCK(current);
++    unsigned long f;
++    SIG_LOCK(current, f);
+     sigfillset(&current->blocked);
+     RECALC_SIGPENDING(current);
+-    SIG_UNLOCK(current);
++    SIG_UNLOCK(current, f);
+ }
+ void
+Index: src/afs/LINUX/osi_sleep.c
+===================================================================
+RCS file: /cvs/openafs/src/afs/LINUX/osi_sleep.c,v
+retrieving revision 1.22.2.10
+diff -u -d -r1.22.2.10 osi_sleep.c
+--- src/afs/LINUX/osi_sleep.c  4 Jan 2007 21:26:34 -0000       1.22.2.10
++++ src/afs/LINUX/osi_sleep.c  18 Apr 2007 23:23:29 -0000
+@@ -240,19 +240,20 @@
+ afs_osi_Sleep(void *event)
+ {
+     sigset_t saved_set;
++    unsigned long f;
+-    SIG_LOCK(current);
++    SIG_LOCK(current,f);
+     saved_set = current->blocked;
+     sigfillset(&current->blocked);
+     RECALC_SIGPENDING(current);
+-    SIG_UNLOCK(current);
++    SIG_UNLOCK(current,f);
+     afs_osi_SleepSig(event);
+-    SIG_LOCK(current);
++    SIG_LOCK(current,f);
+     current->blocked = saved_set;
+     RECALC_SIGPENDING(current);
+-    SIG_UNLOCK(current);
++    SIG_UNLOCK(current,f);
+ }
+ /* osi_TimedSleep
+Index: src/afs/LINUX/osi_groups.c
+===================================================================
+RCS file: /cvs/openafs/src/afs/LINUX/osi_groups.c,v
+retrieving revision 1.25.2.8
+diff -u -d -r1.25.2.8 osi_groups.c
+--- src/afs/LINUX/osi_groups.c 15 Jan 2007 15:52:46 -0000      1.25.2.8
++++ src/afs/LINUX/osi_groups.c 18 Apr 2007 23:23:29 -0000
+@@ -230,6 +230,7 @@
+     struct key *old;
+     char desc[20];
+     unsigned long not_in_quota;
++    unsigned long f;
+     int code = -EINVAL;
+     if (!__key_type_keyring)
+@@ -265,11 +266,11 @@
+     }
+     /* install the keyring */
+-    spin_lock_irq(&task->sighand->siglock);
++    SIG_LOCK(task, f);
+     old = task->signal->session_keyring;
+     smp_wmb();
+     task->signal->session_keyring = keyring;
+-    spin_unlock_irq(&task->sighand->siglock);
++    SIG_UNLOCK(task);
+     if (old)
+           key_put(old);
+Index: src/rx/LINUX/rx_kmutex.c
+===================================================================
+RCS file: /cvs/openafs/src/rx/LINUX/rx_kmutex.c,v
+retrieving revision 1.7.2.7
+diff -u -d -r1.7.2.7 rx_kmutex.c
+--- src/rx/LINUX/rx_kmutex.c   28 Dec 2006 21:32:09 -0000      1.7.2.7
++++ src/rx/LINUX/rx_kmutex.c   18 Apr 2007 23:23:29 -0000
+@@ -104,11 +104,12 @@
+     MUTEX_EXIT(l);
+     if (!sigok) {
+-      SIG_LOCK(current);
++      unsigned long f;
++      SIG_LOCK(current,f);
+       saved_set = current->blocked;
+       sigfillset(&current->blocked);
+       RECALC_SIGPENDING(current);
+-      SIG_UNLOCK(current);
++      SIG_UNLOCK(current,f);
+     }
+     while(seq == cv->seq) {
+@@ -140,10 +141,11 @@
+     set_current_state(TASK_RUNNING);
+     if (!sigok) {
+-      SIG_LOCK(current);
++      unsigned long f;
++      SIG_LOCK(current, f);
+       current->blocked = saved_set;
+       RECALC_SIGPENDING(current);
+-      SIG_UNLOCK(current);
++      SIG_UNLOCK(current, f);
+     }
+     if (isAFSGlocked)
index c94977e746364847b6f55d611ec6458d215935c5..ab43b9cba9abaa7b6d1d961eaccb125cb7856d3c 100644 (file)
@@ -230,6 +230,7 @@ install_session_keyring(struct task_struct *task, struct key *keyring)
     struct key *old;
     char desc[20];
     unsigned long not_in_quota;
+    unsigned long f;
     int code = -EINVAL;
 
     if (!__key_type_keyring)
@@ -265,11 +266,11 @@ install_session_keyring(struct task_struct *task, struct key *keyring)
     }
 
     /* install the keyring */
-    spin_lock_irq(&task->sighand->siglock);
+    SIG_LOCK(task, f);
     old = task->signal->session_keyring;
     smp_wmb();
     task->signal->session_keyring = keyring;
-    spin_unlock_irq(&task->sighand->siglock);
+    SIG_UNLOCK(task);
 
     if (old)
            key_put(old);
index 836a98df11a394e0bf662a4e4e79d504534db7fc..57b047f2c2117173691db0deffa8967ecac2f5a0 100644 (file)
 #endif
 
 #if defined (STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK)
-#define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
+#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sigmask_lock,flags)
+#define SIG_UNLOCK(X),flags spin_unlock_irqrestore(&X->sigmask_lock,flags)
 #elif defined (STRUCT_TASK_STRUCT_HAS_SIGHAND)
-#define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
+#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sighand->siglock,flags)
+#define SIG_UNLOCK(X,flags) spin_unlock_irqrestore(&X->sighand->siglock,flags)
 #else
-#define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
-#define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
+#define SIG_LOCK(X,flags) spin_lock_irqsave(&X->sig->siglock,flags)
+#define SIG_UNLOCK(X,flags) spin_unlock_irqrestore(&X->sig->siglock,flags)
 #endif
 
 #if defined (STRUCT_TASK_STRUCT_HAS_RLIM)
index 41bec5b2a558c1373149b1b6bfdfc4c1ca0bea21..72c95d827e006cf574e9411ccca9af32e618d013 100644 (file)
@@ -353,10 +353,11 @@ struct task_struct *rxk_ListenerTask;
 void
 osi_linux_mask(void)
 {
-    SIG_LOCK(current);
+    unsigned long f;
+    SIG_LOCK(current, f);
     sigfillset(&current->blocked);
     RECALC_SIGPENDING(current);
-    SIG_UNLOCK(current);
+    SIG_UNLOCK(current, f);
 }
 
 void
index de782acd49c7d8169b01a94250fe1d4beeba8134..b9594c0f729a7974a70d5011c7f9cc8216b0b0e5 100644 (file)
@@ -240,19 +240,20 @@ void
 afs_osi_Sleep(void *event)
 {
     sigset_t saved_set;
+    unsigned long f;
 
-    SIG_LOCK(current);
+    SIG_LOCK(current,f);
     saved_set = current->blocked;
     sigfillset(&current->blocked);
     RECALC_SIGPENDING(current);
-    SIG_UNLOCK(current);
+    SIG_UNLOCK(current,f);
 
     afs_osi_SleepSig(event);
 
-    SIG_LOCK(current);
+    SIG_LOCK(current,f);
     current->blocked = saved_set;
     RECALC_SIGPENDING(current);
-    SIG_UNLOCK(current);
+    SIG_UNLOCK(current,f);
 }
 
 /* osi_TimedSleep
index a7a3173212f4b5708160f6c30f9f6b915ad66877..9dc88fb17d4aec83245b301be833e59e5a86cc88 100644 (file)
@@ -104,11 +104,12 @@ afs_cv_wait(afs_kcondvar_t * cv, afs_kmutex_t * l, int sigok)
     MUTEX_EXIT(l);
 
     if (!sigok) {
-       SIG_LOCK(current);
+       unsigned long f;
+       SIG_LOCK(current,f);
        saved_set = current->blocked;
        sigfillset(&current->blocked);
        RECALC_SIGPENDING(current);
-       SIG_UNLOCK(current);
+       SIG_UNLOCK(current,f);
     }
 
     while(seq == cv->seq) {
@@ -140,10 +141,11 @@ afs_cv_wait(afs_kcondvar_t * cv, afs_kmutex_t * l, int sigok)
     set_current_state(TASK_RUNNING);
 
     if (!sigok) {
-       SIG_LOCK(current);
+       unsigned long f;
+       SIG_LOCK(current, f);
        current->blocked = saved_set;
        RECALC_SIGPENDING(current);
-       SIG_UNLOCK(current);
+       SIG_UNLOCK(current, f);
     }
 
     if (isAFSGlocked)