Allow filing system to access files during close(). Without
this fix, any file access causes a deadlock during
close().
E.g. I've implemented a tftp get/put filing system for our application.
--
Øyvind Harboe
http://www.zylin.com - eCos ARM & FPGA developer kit
### Eclipse Workspace Patch 1.0
#P ecos
Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.67
diff -u -r1.67 ChangeLog
--- io/fileio/current/ChangeLog 17 Aug 2007 19:32:26 -0000 1.67
+++ io/fileio/current/ChangeLog 24 Jan 2008 11:30:46 -0000
@@ -1,3 +1,7 @@
+2008-01-24 Oyvind Harboe <[EMAIL PROTECTED]>
+
+ * src/fd.cxx: fix deadlock when accessing files during close().
+
2007-08-17 Hans Rosenfeld <[EMAIL PROTECTED]>
tests/fnmatch.c (main): Fix cut/paste error in final pass/fail
Index: io/fileio/current/src/fd.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/fd.cxx,v
retrieving revision 1.7
diff -u -r1.7 fd.cxx
--- io/fileio/current/src/fd.cxx 7 Apr 2004 11:18:54 -0000 1.7
+++ io/fileio/current/src/fd.cxx 24 Jan 2008 11:30:46 -0000
@@ -157,7 +157,11 @@
{
cyg_file_lock( fp, fp->f_syncmode );
+ FILEIO_MUTEX_UNLOCK(fdlock);
+ // closing the file might involve other file operations, e.g.
+ // tcp/ip communication on sockets.
error = fp->f_ops->fo_close(fp);
+ FILEIO_MUTEX_LOCK(fdlock);
cyg_file_unlock( fp, fp->f_syncmode );