summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-03 11:49:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-08-03 23:56:01 +0100
commit6c7c0cefd34067311144a1d4c01986fe0a4aef26 (patch)
tree3f711509e625e7aae4d4cc2f2044b32dd6b479ac /meta
parentdad9cd5cca1a09f33f0fd82a6bcbed31936ad6c8 (diff)
downloadpoky-6c7c0cefd34067311144a1d4c01986fe0a4aef26.tar.gz
sstate: Reduce race windows
When we write to the sstate directory we try to do so atomically so consumers either see one version or another but never an imcomplete file. Unfortunately this is reliant on filesystem support and with some NFS configurations a replaced file would be lost from memory even if users held open descriptors. It makes sense to try and avoid replacing existing files where we can. (From OE-Core rev: 18cdc087fd5da30e2b31f3d4e81b153cd36ca844) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sstate.bbclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index ee029196da..a0ca199867 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -755,6 +755,11 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
755sstate_create_package () { 755sstate_create_package () {
756 TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX` 756 TFILE=`mktemp ${SSTATE_PKG}.XXXXXXXX`
757 757
758 # Exit earlu if it already exists
759 if [ -e ${SSTATE_PKG} ]; then
760 return
761 fi
762
758 # Use pigz if available 763 # Use pigz if available
759 OPT="-czS" 764 OPT="-czS"
760 if [ -x "$(command -v pigz)" ]; then 765 if [ -x "$(command -v pigz)" ]; then
@@ -774,7 +779,12 @@ sstate_create_package () {
774 tar $OPT --file=$TFILE --files-from=/dev/null 779 tar $OPT --file=$TFILE --files-from=/dev/null
775 fi 780 fi
776 chmod 0664 $TFILE 781 chmod 0664 $TFILE
777 mv -f $TFILE ${SSTATE_PKG} 782 # Skip if it was already created by some other process
783 if [ ! -e ${SSTATE_PKG} ]; then
784 mv -f $TFILE ${SSTATE_PKG}
785 else
786 rm $TFILE
787 fi
778} 788}
779 789
780python sstate_sign_package () { 790python sstate_sign_package () {