This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: jffs2 umount


Andrew,

seems I was too quick to agree with you. A second look at the code
reveals that the superblock _is_ actually freed, and so my original
patch was almost correct. The only thing it missed was to zero out the
data field in the mount table entry, so when the file system was
mounted again, a stale superblock would have been used.

The current code is obviously incorrect as it accesses memory that
has been freed. The attached patch should finally do it the right
way now.

tk

Andrew Lunn wrote:
> On Sun, Sep 21, 2003 at 10:38:13PM +0200, Thomas Koeller wrote:
> > The jffs2_umount() function always decrements the mount count
> > for the file system, even if the umount attempt fails with
> > EBUSY. This means the umount can never be retried. Patch
> > attached.
>
> It was not quite correct. You didn't decrement the mount count for
> successful umount's. This may not actually be necessary, but the old
> code would do it. Here i what i've committed.



diff -ru packages-orig/fs/jffs2/current/ChangeLog 
packages/fs/jffs2/current/ChangeLog
--- packages-orig/fs/jffs2/current/ChangeLog	Tue Sep 23 22:59:06 2003
+++ packages/fs/jffs2/current/ChangeLog	Tue Sep 23 23:44:55 2003
@@ -1,5 +1,9 @@
 2003-09-23  Thomas Koeller  <thomas.koeller@baslerweb.com>
 
+        * src/fs-ecos.c: Another umount() fix.
+	
+2003-09-23  Thomas Koeller  <thomas.koeller@baslerweb.com>
+
         * src/fs-ecos.c: Fixed broken hard link creation.
 	
 2003-09-23  Andrew Lunn     <andrew.lunn@ascom.ch>
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	Tue Sep 23 22:59:06 2003
+++ packages/fs/jffs2/current/src/fs-ecos.c	Wed Sep 24 00:08:30 2003
@@ -601,14 +601,15 @@
 		free(c->blocks);
 		free(c->inocache_list);
 		free(jffs2_sb);
-		// Clear root pointer
+		// Clear superblock & root pointers
 		mte->root = CYG_DIR_NULL;
+		mte->data = 0;
 		mte->fs->data = 0;	// fstab entry, visible to all mounts. No current mount
 		// That's all folks.
 		D2(printf("jffs2_umount No current mounts\n"));
+	} else {
+        	jffs2_sb->s_mount_count--;
 	}
-	
-        jffs2_sb->s_mount_count--;
 
 	return ENOERR;
 }



-- 
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]