~siretart/cryptsetup/debian

« back to all changes in this revision

Viewing changes to debian/patches/06_run_udevsettle.dpatch

  • Committer: Reinhard Tartler
  • Date: 2008-05-25 17:39:39 UTC
  • Revision ID: siretart@tauware.de-20080525173939-1tpwdw113sujd8za
import cryptsetup_1.0.6~pre1-1.dsc

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
 
 
3
## 06_run_udevsettle.dpatch
 
4
## by Reinhard Tartler <siretart@ubuntu.com>
 
5
##
 
6
## All lines beginning with `## DP:' are a description of the patch.
 
7
## DP: run udevsettle after dm device creation
 
8
## DP: See https://bugs.launchpad.net/bugs/132373
 
9
 
 
10
@DPATCH@
 
11
diff -urNad cryptsetup-1.0.6~pre1~/lib/libdevmapper.c cryptsetup-1.0.6~pre1/lib/libdevmapper.c
 
12
--- cryptsetup-1.0.6~pre1~/lib/libdevmapper.c   2007-10-25 09:11:19.000000000 +0200
 
13
+++ cryptsetup-1.0.6~pre1/lib/libdevmapper.c    2007-12-04 13:29:05.000000000 +0100
 
14
@@ -18,13 +18,6 @@
 
15
 
 
16
 #define        CRYPT_TARGET    "crypt"
 
17
 
 
18
-#define UDEVSETTLE     "/sbin/udevsettle"
 
19
-
 
20
-static void run_udevsettle(void)
 
21
-{
 
22
-       system(UDEVSETTLE);
 
23
-}
 
24
-
 
25
 static void set_dm_error(int level, const char *file, int line,
 
26
                          const char *f, ...)
 
27
 {
 
28
@@ -191,9 +184,21 @@
 
29
        if (dmi.read_only)
 
30
                options->flags |= CRYPT_FLAG_READONLY;
 
31
 
 
32
-       /* run udevsettle to avoid a race in libdevmapper causing busy dm devices */
 
33
-       run_udevsettle();
 
34
-
 
35
+       /*
 
36
+        * patch inspired from
 
37
+        * https://bugzilla.novell.com/show_bug.cgi?id=285478
 
38
+        *
 
39
+        * At this point, it is quite likely that there are currently
 
40
+        * devmapper events being processed. In order to avoid
 
41
+        * workarounds (which involve calling udevsettle at the
 
42
+        * 'right' places in scripts integrating cryptsetup), we are
 
43
+        * checking here if udevsettle is available and call it if it
 
44
+        * is.
 
45
+        */
 
46
+       if (0 == access("/sbin/udevsettle", X_OK)) {
 
47
+               system("/sbin/udevsettle");
 
48
+       }
 
49
+       
 
50
        r = 0;
 
51
        
 
52
 out: