Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Jonathan Liu <net147@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] boot-directdisk: Fix race condition with bootimg
Date: Thu,  2 May 2013 00:22:38 +1000	[thread overview]
Message-ID: <1367418158-28751-1-git-send-email-net147@gmail.com> (raw)

If "vmdk" is added to IMAGE_FSTYPES when building core-image-minimal,
there is a race condition where the bootdirectdisk and bootimg tasks
may execute concurrently. The bootdirectdisk task is copying the
contents of ${HDDDIR} into ${HDDIMG} but at the same time, the bootimg
task is writing to ${HDDDIR}/rootfs.img.

This race condition can result in one of the following errors:
- An hdddirect image is created with an incomplete rootfs.img
  (the bootimg task may not have finished writing to rootfs.img yet).
  This would result in an invalid operation error when /init in initrd
  tries to loopback mount rootfs.img to /rootfs.
- A "Disk full" error is generated in the bootdirectdisk task
  because it calculates the number of blocks for the image before
  rootfs.img is written but by the time is gets to copying the contents
  of ${HDDDIR} into ${HDDIMG}, the writing of ${HDDDIR}/rootfs.img by
  the bootimg task results in the size of ${HDDDIR} exceeding the
  initially calculated number of blocks for the image.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/classes/boot-directdisk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index d265485..fcbee8a 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -96,5 +96,5 @@ python do_bootdirectdisk() {
     bb.build.exec_func('build_boot_dd', d)
 }
 
-addtask bootdirectdisk before do_build
+addtask bootdirectdisk after do_bootimg before do_build
 do_bootdirectdisk[nostamp] = "1"
-- 
1.8.2.1




             reply	other threads:[~2013-05-01 14:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 14:22 Jonathan Liu [this message]
2013-05-01 15:22 ` [PATCH] boot-directdisk: Fix race condition with bootimg Jonathan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367418158-28751-1-git-send-email-net147@gmail.com \
    --to=net147@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox