[U-Boot] [PATCH 05/12] tools/env: Serialize calls to fw_*env

Joe Hershberger joe.hershberger at gmail.com
Wed Oct 3 03:12:05 CEST 2012


Hi Mike,

Sorry for the delay... I've been distracted.

On Wed, Aug 22, 2012 at 10:33 PM, Mike Frysinger <vapier at gentoo.org> wrote:
> On Friday 17 August 2012 16:49:39 Joe Hershberger wrote:
>> Use a lock file at /var/lock/fw_printenv.lock.
>
> the lock should be per-MTD, not per-system.

I'm not sure that's the case.  The idea is to prevent the tool from
running more than once at a time.  I don't think it matters which mtd
is being accessed as we want all the mtd accesses across the whole
operation to be atomic.

If you are talking about having two independent sets of environments
accessed at the same time, then there are other reasons (such as the
config file) that make that not possible for now, and it seems like
it's an out-there use-case.

>> +     if (-1 == flock(lockfd, LOCK_EX)) {
>
> i guess flock() on the fd returned from the mtd device itself doesn't work ?

Again.. the thought it to be atomic across all accesses.  We want to
avoid the read / modify / write problems.

Thanks,
-Joe


More information about the U-Boot mailing list