This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: JFFS2 : Node info mutex fix suggestion.
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Alf Nilsson <alf dot nilsson at abem dot se>
- Cc: ecos-patches at sources dot redhat dot com
- Date: Tue, 17 Feb 2004 08:35:22 -0700
- Subject: Re: JFFS2 : Node info mutex fix suggestion.
- Organization: MLB Associates
- References: <402BA793.4080805@abem.se>
On Thu, 2004-02-12 at 09:19, Alf Nilsson wrote:
> When running a project with priority inheritance we noticed that all the
> threads that passed though JFFS did not return to their original
> priority. This due to the mutex count in the jffs2_inode_info was in
> some cases 2 as lowest. We found that this depended on a call to
> fs-ecos.c:jffs2_init_inode_info in fs-ecos.c:jffs2_new_inode. The 2nd
> call in fs-ecos.c:jffs2_new_inode that increases the mutex occurs in
> read.c:jffs2_do_new_inode.
> This might not be the ultimate solution, but it seemed like the right
> place to place the patch, but I'm open for suggestions.
After consulting with David Woodhouse (the JFFS2 maintainer), I've
committed the following change(s). Please let us know if you have
other problems.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: fs/jffs2/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/fs/jffs2/current/ChangeLog,v
retrieving revision 1.24
diff -u -5 -p -r1.24 ChangeLog
--- fs/jffs2/current/ChangeLog 27 Jan 2004 10:49:06 -0000 1.24
+++ fs/jffs2/current/ChangeLog 17 Feb 2004 15:32:35 -0000
@@ -1,14 +1,22 @@
-2004-01-09 Thomas Koeller <thomas.koeller@baslerweb.com>
+2004-02-17 David Woodhouse <dwmw2@redhat.com>
- * src/fs-ecos.c: Fixed inode reference counting in jffs2_ops_link().
+ * src/fs-ecos.c:
+ Don't re-initialise the already-locked f->sem. It makes eCos unhappy.
-2004-01-05 Thomas Koeller <thomas.koeller@baslerweb.com>
+2004-01-27 David Woodhouse <dwmw2@redhat.com>
- * cdl/jffs2.cdl: Re-added CYGPKG_FS_JFFS2_CFLAGS_REMOVE that had been
- removed by previous change.
+ * src/write.c:
+ Fix bug noted by Howard Gray; dirents belong to, and should dirty,
+ the _parent_inode, not the child (which may be zero in the case
+ of an unlink).
+
+004-01-05 Thomas Koeller <thomas.koeller@baslerweb.com>
+ * cdl/jffs2.cdl: Re-added CYGPKG_FS_JFFS2_CFLAGS_REMOVE that had been
+ removed by previous change.
+
2003-11-26 David Woodhouse <dwmw2@redhat.com>
JFFS2 cleanup and import of newer code. Remove last vestiges of
Linuxisms such as 'struct inode' from the core code, leaving eCos
with no excuse, and renaming the eCos 'struct inode' to make that
Index: fs/jffs2/current/src/fs-ecos.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.17
diff -u -5 -p -r1.17 fs-ecos.c
--- fs/jffs2/current/src/fs-ecos.c 27 Jan 2004 10:49:06 -0000 1.17
+++ fs/jffs2/current/src/fs-ecos.c 17 Feb 2004 15:04:38 -0000
@@ -989,10 +989,11 @@ static int jffs2_ops_link(cyg_mtab_entry
return EEXIST;
}
// Allow through links to non-existing terminal objects
if (ds2.last && err == ENOENT) {
+ jffs2_iput(ds2.node);
ds2.node = NULL;
err = ENOERR;
}
if (err != ENOERR) {
Index: fs/jffs2/current/src/write.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/fs/jffs2/current/src/write.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 write.c
--- fs/jffs2/current/src/write.c 11 Dec 2003 23:33:55 -0000 1.5
+++ fs/jffs2/current/src/write.c 17 Feb 2004 15:04:38 -0000
@@ -5,11 +5,11 @@
*
* Created by David Woodhouse <dwmw2@redhat.com>
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: write.c,v 1.79 2003/12/03 09:41:03 dwmw2 Exp $
+ * $Id: write.c,v 1.81 2004/02/17 14:58:16 dwmw2 Exp $
*
*/
#include <linux/kernel.h>
#include <linux/fs.h>
@@ -29,11 +29,10 @@ int jffs2_do_new_inode(struct jffs2_sb_i
return -ENOMEM;
}
memset(ic, 0, sizeof(*ic));
- init_MUTEX_LOCKED(&f->sem);
f->inocache = ic;
f->inocache->nlink = 1;
f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache;
f->inocache->ino = ++c->highest_ino;
f->inocache->state = INO_STATE_PRESENT;
@@ -277,11 +276,11 @@ struct jffs2_full_dirent *jffs2_write_di
raw->flash_offset = flash_ofs;
raw->__totlen = PAD(sizeof(*rd)+namelen);
raw->next_phys = NULL;
ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
- (alloc_mode==ALLOC_GC)?0:fd->ino);
+ (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
if (ret || (retlen != sizeof(*rd) + namelen)) {
printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
sizeof(*rd)+namelen, flash_ofs, ret, retlen);
/* Mark the space as dirtied */
if (retlen) {