[ECOS] Deadlock when closing file

Øyvind Harboe oyvind.harboe@zylin.com
Fri Jan 18 12:31:00 GMT 2008

I've made a tftp file system. Relatively straightforward w/eCos.

Mounting this device at /tftp, I can read/write files using the
following path syntax: /tftp/ This
adds tftp client get/set to my app without modifying the app.

However, tftp_client_put() needs to be done at close() time and
FILEIO_MUTEX_LOCK(fdlock) is held when co_close() is invoked.

fo_sync() is not invoked when the application (which I can't
really modify) calls close().

With the attached patch, I no longer get the deadlock, but I don't
quite understand this code or API contract well enough
to know how and why the FILEIO_MUTEX_LOCK(fdlock) should be

Would it be possible to rewrite io/fileio/current/src/fd.cxx not to
hold FILEIO_MUTEX_LOCK() during fo_close() without
breaking something?

Should close() invoke fsync()?

Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA  developer kit
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: flushproblems.txt
URL: <http://sourceware.org/pipermail/ecos-discuss/attachments/20080118/09c7a354/attachment.txt>
-------------- next part --------------
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list