Patchwork [v2,11/12] udev-cache: Update cache asynchronously

login
register
mail settings
Submitter Richard Tollerton
Date Aug. 22, 2014, 9:30 p.m.
Message ID <6822c2d4645105e779ce13935e5631dbf08fb049.1408742574.git.rich.tollerton@ni.com>
Download mbox | patch
Permalink /patch/78839/
State New
Headers show

Comments

Richard Tollerton - Aug. 22, 2014, 9:30 p.m.
Don't hold up the boot while the cache is being updated.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
---
 meta/recipes-core/udev/udev/udev-cache | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Patch

diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index c499676..baeb125 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -43,14 +43,17 @@  fi
 
 if [ "$DEVCACHE" != "" -a -e "$DEVCACHE_REGEN" ]; then
 	echo "Populating dev cache"
-	# Run sysconf_cmd before `tar`, not after, so that as little time as
-	# possible elapses between creating $SYSCONF_CACHED and $DEVCACHE.
-	sysconf_cmd > "$SYSCONF_CACHED"
-	find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
-		| xargs tar cf "${DEVCACHE_TMP}" -T-
-	gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
-	rm -f "${DEVCACHE_TMP}"
-	rm -f "$DEVCACHE_REGEN"
+	(
+		# Run sysconf_cmd before `tar`, not after, so that as little
+		# time as possible elapses between creating $SYSCONF_CACHED and
+		# $DEVCACHE.
+		sysconf_cmd > "$SYSCONF_CACHED"
+		find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
+			| xargs tar cf "${DEVCACHE_TMP}" -T-
+		gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
+		rm -f "${DEVCACHE_TMP}"
+		rm -f "$DEVCACHE_REGEN"
+	) &
 fi
 
 exit 0