All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Jackson <mpfj-list@newflow.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools/fw_env: use fsync to ensure that data is physically stored
Date: Wed, 22 May 2013 16:33:52 +0100	[thread overview]
Message-ID: <519CE560.50105@newflow.co.uk> (raw)
In-Reply-To: <456389491.x65y6Gi2JO@kerker>

On 21/05/13 18:34, Michael Heimpold wrote:
> Hi Wolfgang Denx,
> 
>>> Closing a file descriptor does not guarantee that the data has been
>>> successfully saved to disk, as the kernel might defer the write.
>>
>> What is the exact problem you are trying to fix?
>>
>> I mean, when exactly does adding the sync play a role?
> 
> I'm using fw_setenv during system update process. The sequence
> of such a shell script is something like (much simplified):
> 
> ...
> fw_setenv state=2
> dd if=... of=/dev/mmcblk0...
> fw_setenv state=1
> ...
> reboot

Not sure what final "OS" environment you're running, but I would think
that "reboot" would sync for you ?

For instance, under BusyBox, we have:-

# reboot --help
BusyBox v1.14.0 (2012-02-15 10:28:26 GMT) multi-call binary

Usage: reboot [-d delay] [-n] [-f]

Reboot the system

Options:
	-d	Delay interval for rebooting
	-n	No call to sync()
	-f	Force reboot (don't go through init)

... and under Ubuntu, we have ...

$ reboot --help
Usage: reboot [OPTION]...
Reboot the system.

Options:
  -n, --no-sync               don't sync before reboot or halt
...

So by default, reboot would (should ?) call sync automatically.

This might point to some other issue ?

Mark J.

  parent reply	other threads:[~2013-05-22 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 19:34 [U-Boot] [PATCH] tools/fw_env: use fsync to ensure that data is physically stored Michael Heimpold
2013-05-21 12:47 ` Wolfgang Denk
2013-05-21 17:34   ` Michael Heimpold
2013-05-22 14:32     ` Mats Kärrman
2013-05-22 15:33     ` Mark Jackson [this message]
2013-05-22 18:32       ` Michael Heimpold
2017-07-25  0:42 ` [U-Boot] " Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2017-07-13 13:11 [U-Boot] [PATCH] " Vincent Prince
2017-07-14  9:07 ` Vincent Prince

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=519CE560.50105@newflow.co.uk \
    --to=mpfj-list@newflow.co.uk \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.