[ECOS] RE : [ECOS] Is JFFS2 thread-safe?

David Woodhouse dwmw2@infradead.org
Sat Nov 29 19:40:00 GMT 2003

On Sat, 2003-11-29 at 15:47 +0000, Nick Garnett wrote:
> For these reasons, making spin_lock() et al use the scheduler lock is
> probably a bad idea, it would have an effect on the whole system if
> they were held for long periods of time.

OK. That was a brain fart on my part -- in Linux without preemptive
scheduling, you mustn't sleep with spinlocks held, and with preemptive
scheduling a spin_lock() prevents preemption... I was applying that same
'knowledge' and thinking that preemption would lead to deadlock as it
would under Linux. That's obviously bogus.

We use spin_lock() in JFFS2 as a short-lived lightweight mutex; we could
map it to eCos spinlocks or mutexes as you see fit -- as long as it's
mapped to _something_ in the case where preemptive scheduling happens,
I'm happy. Only in the absence of preemption is it safe in its current
'do {} while(0)' form.

Having tidied up most of the interface between core JFFS2 code and the
eCos-specific parts, the latter could really do with some TLC from
someone who knows eCos a lot better than I do.


Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list