Patchwork initscripts: don't background volatile creation

login
register
mail settings
Submitter Christopher Larson
Date June 24, 2011, 6:09 p.m.
Message ID <1308938954-10349-1-git-send-email-kergoth@gmail.com>
Download mbox | patch
Permalink /patch/6481/
State New, archived
Headers show

Comments

Christopher Larson - June 24, 2011, 6:09 p.m.
From: Chris Larson <chris_larson@mentor.com>

This fix is courtesy Chris Hallinan. There is/can be assumptions made in
the volatiles file that they're processed in order (e.g. directory
created, then files within that directory), yet the script processes
them in parallel, backgrounding the operations. This is racy, and means
it's possible to end up with dependent files/dirs not created before the
bits that need them.

It's likely that this will have a performance impact, but I haven't
benchmarked it. Better that we behave correctly than quickly. We can
look back into improving the speed of this, without breaking
dependencies, in the future.

Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
 .../initscripts-1.0/populate-volatile.sh           |   12 ++++++------
 recipes/initscripts/initscripts_1.0.bb             |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/recipes/initscripts/initscripts-1.0/populate-volatile.sh b/recipes/initscripts/initscripts-1.0/populate-volatile.sh
index f0a45ea..d9ec1b7 100755
--- a/recipes/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/recipes/initscripts/initscripts-1.0/populate-volatile.sh
@@ -19,7 +19,7 @@  create_file() {
 	[ -e "$1" ] && {
 	  [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -34,7 +34,7 @@  mk_dir() {
 	[ -e "$1" ] && {
 	  [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -46,7 +46,7 @@  link_file() {
 	[ -e "$2" ] && {
 	  echo "Cannot create link over existing -${TNAME}-." >&2
 	} || {
-	  eval $EXEC &
+	  eval $EXEC
 	}
 }
 
@@ -123,7 +123,7 @@  apply_cfgfile() {
       TSOURCE="$TLTARGET"
       [ -L "${TNAME}" ] || {
         [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
-        link_file "${TSOURCE}" "${TNAME}" &
+        link_file "${TSOURCE}" "${TNAME}"
         }
       continue
       }
@@ -142,10 +142,10 @@  apply_cfgfile() {
 
     case "${TTYPE}" in
       "f")  [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
-            create_file "${TNAME}" &
+            create_file "${TNAME}"
 	    ;;
       "d")  [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
-            mk_dir "${TNAME}" &
+            mk_dir "${TNAME}"
 	    # Add check to see if there's an entry in fstab to mount.
 	    ;;
       *)    [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
diff --git a/recipes/initscripts/initscripts_1.0.bb b/recipes/initscripts/initscripts_1.0.bb
index 87a0e99..adf8594 100644
--- a/recipes/initscripts/initscripts_1.0.bb
+++ b/recipes/initscripts/initscripts_1.0.bb
@@ -4,7 +4,7 @@  PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS_${PN} = "makedevs"
 LICENSE = "GPL"
-PR = "r128"
+PR = "r129"
 
 SRC_URI = "file://functions \
            file://halt \