jffs2 stat() returns bogus inode numbers

Thomas Koeller thomas.koeller@baslerweb.com
Thu Sep 18 19:18:00 GMT 2003


Here is a patch that fixes an issue with the stat() call
for jffs2. The inode number returned used to be the address
of the inode in the inode cache. Inode numbers generated in
this way are not unique. In my program I called stat() for
multiple files in a loop. For every pass through the loop,
the inode was purged from the cache, freed and immediatly
reallocated at the same address, resulting in identical
'inode numbers' returned for all files. The attached patch
fixes this.



diff -ru packages-orig/fs/jffs2/current/ChangeLog packages/fs/jffs2/current/ChangeLog
--- packages-orig/fs/jffs2/current/ChangeLog	2003-08-05 17:25:26.000000000 +0200
+++ packages/fs/jffs2/current/ChangeLog	2003-09-18 21:08:54.000000000 +0200
@@ -1,3 +1,7 @@
+2003-09-18  Thomas Koeller  <thomas.koeller@baslerweb.com>
+
+	* src/fs-ecos.c: Inode number returned by stat() was bogus.
+
 2003-07-27  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/os-ecos.h: Added new #defines require for the recent jffs2
diff -ru packages-orig/fs/jffs2/current/src/fs-ecos.c packages/fs/jffs2/current/src/fs-ecos.c
--- packages-orig/fs/jffs2/current/src/fs-ecos.c	2003-08-05 17:25:26.000000000 +0200
+++ packages/fs/jffs2/current/src/fs-ecos.c	2003-09-18 21:03:46.000000000 +0200
@@ -1143,7 +1143,7 @@
 
 	// Fill in the status
 	buf->st_mode = ds.node->i_mode;
-	buf->st_ino = (ino_t) ds.node;
+	buf->st_ino = ds.node->i_ino;
 	buf->st_dev = 0;
 	buf->st_nlink = ds.node->i_nlink;
 	buf->st_uid = 0;


--------------------------------------------------

Thomas Koeller, Software Development

Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany

Tel +49 (4102) 463-162
Fax +49 (4102) 463-239

mailto:thomas.koeller@baslerweb.com
http://www.baslerweb.com

==============================



More information about the Ecos-patches mailing list