This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
RE: jffs2 umount
- From: "Koeller, T." <Thomas dot Koeller at baslerweb dot com>
- To: 'Andrew Lunn' <andrew at lunn dot ch>
- Cc: ecos-patches at sources dot redhat dot com
- Date: Tue, 23 Sep 2003 13:09:24 +0200
- Subject: RE: jffs2 umount
You are right. I assumed the superblock would be deleted when
unmounting the file system, so its contents didn't matter. But
after checking again I found that it is actually reused if the
file system is re-mounted later.
In this case, that patch could take a simpler form where the
mount count is unconditionally decremented at the end, outside
the 'if' statement.
tk
-----------------------------------------------
Thomas Koeller, Software Development
Basler Vision Technologies
An der Strusbek 60-62
22926 Ahrensburg
Germany
Tel +49 (4102) 463-390
Fax +49 (4102) 463-46390
mailto:Thomas.Koeller@baslerweb.com
http://www.baslerweb.com
> -----Original Message-----
> From: Andrew Lunn [mailto:andrew@lunn.ch]
> Sent: Tuesday, September 23, 2003 12:21 PM
> To: Thomas Koeller
> Cc: ecos-patches@sources.redhat.com
> Subject: Re: jffs2 umount
>
>
> 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.
>
> Andrew
>
> Index: packages/fs/jffs2/current//ChangeLog
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/ChangeLog,v
> retrieving revision 1.12
> diff -u -r1.12 ChangeLog
> --- packages/fs/jffs2/current//ChangeLog 19 Sep 2003
> 00:21:46 -0000 1.12+++
> packages/fs/jffs2/current//ChangeLog 23 Sep 2003 10:20:07 -0000
> @@ -1,3 +1,9 @@
> +2003-09-21 Thomas Koeller <thomas.koeller@baslerweb.com>
> + Andrew Lunn <andrew.lunn@ascom.ch>
> +
> + * src/fs-ecos.c: Do not decrement mount count for unsuccessful
> + umount attempts.
> +
> 2003-09-19 Thomas Koeller <thomas.koeller@baslerweb.com>
>
> * src/fs-ecos.c: Another inode number fix.
> Index: packages/fs/jffs2/current//src/fs-ecos.c
> ===================================================================
> RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
> retrieving revision 1.7
> diff -u -r1.7 fs-ecos.c
> --- packages/fs/jffs2/current//src/fs-ecos.c 19 Sep 2003
> 00:21:46 -0000 1.7
> +++ packages/fs/jffs2/current//src/fs-ecos.c 23 Sep 2003
> 10:20:10 -0000
> @@ -584,17 +584,15 @@
>
> D2(printf("jffs2_umount\n"));
>
> - // Decrement the mount count
> - jffs2_sb->s_mount_count--;
> -
> // Only really umount if this is the only mount
> - if (jffs2_sb->s_mount_count == 0) {
> + if (jffs2_sb->s_mount_count == 1) {
>
> // Check for open/inuse root or any cached inodes
> //if( root->i_count != 1 || root->i_cache_next != NULL) //
> root icount was set to 1 on mount
> if (root->i_cache_next != NULL) // root
> icount was set to 1 on mount return EBUSY;
> -
> +
> + jffs2_sb->s_mount_count--;
> dec_refcnt(root); // Time to free the root inode
>
> //Clear root inode
> @@ -611,7 +609,8 @@
> 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--;
>
> return ENOERR;
> }
>