Patchwork [08/20] udev-cache: Create cache asynchronously

login
register
mail settings
Submitter Ben Shelton
Date Aug. 4, 2014, 6:41 p.m.
Message ID <13060467d5be9274cbe18b3791bbf10f5a2d7abb.1407177403.git.ben.shelton@ni.com>
Download mbox | patch
Permalink /patch/77239/
State New
Headers show

Comments

Ben Shelton - Aug. 4, 2014, 6:41 p.m.
From: Richard Tollerton <rich.tollerton@ni.com>

Don't hold up the boot while the cache tarball is created.

Natinst-Rally-ID: TA44427
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Natinst-ReviewBoard-ID: 58620
Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
---
 meta/recipes-core/udev/udev/udev-cache | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Otavio Salvador - Aug. 4, 2014, 7:41 p.m.
On Mon, Aug 4, 2014 at 3:41 PM, Ben Shelton <ben.shelton@ni.com> wrote:
> From: Richard Tollerton <rich.tollerton@ni.com>
>
> Don't hold up the boot while the cache tarball is created.
>
> Natinst-Rally-ID: TA44427
> Acked-by: Gratian Crisan <gratian.crisan@ni.com>
> Natinst-ReviewBoard-ID: 58620
> Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>

I am not sure about this one. I see the value you are adding here but
I worry how often something can be connected during this process and
change the contents along the way. Did you see something as that
during your tests?

Patch

diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
index 679adb4..e730608 100644
--- a/meta/recipes-core/udev/udev/udev-cache
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -25,9 +25,11 @@  fi
 
 if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
 	[ "${VERBOSE}" != "no" ] && echo "Populating dev cache"
-	tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
-	mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
-	mv /dev/shm/udev.cache /etc/udev/cache.data
+	(
+		tar czf "${DEVCACHE}.tmp" dev -C / --exclude=log
+		mv -f "${DEVCACHE}.tmp" "$DEVCACHE"
+		mv /dev/shm/udev.cache /etc/udev/cache.data
+	) &
 fi
 
 exit 0